mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Fix reparent on windows
R=brianwilkerson@google.com Review-Url: https://codereview.chromium.org/2892963002 .
This commit is contained in:
parent
a8dc041543
commit
5455f21565
2 changed files with 54 additions and 3 deletions
|
@ -1770,10 +1770,12 @@ class AssistProcessor {
|
|||
sb.append('(');
|
||||
if (newExprSrc.contains(eol)) {
|
||||
int newlineIdx = newExprSrc.lastIndexOf(eol);
|
||||
if (newlineIdx == newExprSrc.length - 1) {
|
||||
newlineIdx -= 1;
|
||||
int eolLen = eol.length;
|
||||
if (newlineIdx == newExprSrc.length - eolLen) {
|
||||
newlineIdx -= eolLen;
|
||||
}
|
||||
String indentOld = utils.getLinePrefix(newExpr.offset + 1 + newlineIdx);
|
||||
String indentOld =
|
||||
utils.getLinePrefix(newExpr.offset + eolLen + newlineIdx);
|
||||
String indentNew = '$indentOld${utils.getIndent(1)}';
|
||||
sb.append(eol);
|
||||
sb.append(indentNew);
|
||||
|
|
|
@ -3994,6 +3994,55 @@ class FakeFlutter {
|
|||
''');
|
||||
}
|
||||
|
||||
test_reparentFlutterWidget_OK_multiLines_eol2() async {
|
||||
_configureFlutterPkg({
|
||||
'src/widgets/framework.dart': flutter_framework_code,
|
||||
});
|
||||
await resolveTestUnit('''
|
||||
import 'package:flutter/src/widgets/framework.dart';\r
|
||||
class FakeFlutter {\r
|
||||
main() {\r
|
||||
return new Container(\r
|
||||
// start\r
|
||||
child: new /*caret*/DefaultTextStyle(\r
|
||||
child: new Row(\r
|
||||
children: <Widget>[\r
|
||||
new Container(\r
|
||||
),\r
|
||||
],\r
|
||||
),\r
|
||||
),\r
|
||||
// end\r
|
||||
);\r
|
||||
}\r
|
||||
}\r
|
||||
''');
|
||||
_setCaretLocation();
|
||||
await assertHasAssist(
|
||||
DartAssistKind.REPARENT_FLUTTER_WIDGET,
|
||||
'''
|
||||
import 'package:flutter/src/widgets/framework.dart';\r
|
||||
class FakeFlutter {\r
|
||||
main() {\r
|
||||
return new Container(\r
|
||||
// start\r
|
||||
child: new widget(\r
|
||||
child: new /*caret*/DefaultTextStyle(\r
|
||||
child: new Row(\r
|
||||
children: <Widget>[\r
|
||||
new Container(\r
|
||||
),\r
|
||||
],\r
|
||||
),\r
|
||||
),\r
|
||||
),\r
|
||||
// end\r
|
||||
);\r
|
||||
}\r
|
||||
}\r
|
||||
''');
|
||||
}
|
||||
|
||||
test_reparentFlutterWidget_OK_singleLine1() async {
|
||||
_configureFlutterPkg({
|
||||
'src/widgets/framework.dart': flutter_framework_code,
|
||||
|
|
Loading…
Reference in a new issue