Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: pkg/analysis_server/lib/src/services/correction/assist_internal.dart

Issue 2892963002: Fix reparent on windows (Closed)
Patch Set: Added a test Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/assist_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library services.src.correction.assist; 5 library services.src.correction.assist;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; 10 import 'package:analysis_server/plugin/edit/assist/assist_core.dart';
(...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 } 1765 }
1766 String newExprSrc = utils.getNodeText(newExpr); 1766 String newExprSrc = utils.getNodeText(newExpr);
1767 SourceBuilder sb = new SourceBuilder(file, newExpr.offset); 1767 SourceBuilder sb = new SourceBuilder(file, newExpr.offset);
1768 sb.append('new '); 1768 sb.append('new ');
1769 sb.startPosition('WIDGET'); 1769 sb.startPosition('WIDGET');
1770 sb.append('widget'); 1770 sb.append('widget');
1771 sb.endPosition(); 1771 sb.endPosition();
1772 sb.append('('); 1772 sb.append('(');
1773 if (newExprSrc.contains(eol)) { 1773 if (newExprSrc.contains(eol)) {
1774 int newlineIdx = newExprSrc.lastIndexOf(eol); 1774 int newlineIdx = newExprSrc.lastIndexOf(eol);
1775 if (newlineIdx == newExprSrc.length - 1) { 1775 int eolLen = eol.length;
1776 newlineIdx -= 1; 1776 if (newlineIdx == newExprSrc.length - eolLen) {
1777 newlineIdx -= eolLen;
1777 } 1778 }
1778 String indentOld = utils.getLinePrefix(newExpr.offset + 1 + newlineIdx); 1779 String indentOld =
1780 utils.getLinePrefix(newExpr.offset + eolLen + newlineIdx);
1779 String indentNew = '$indentOld${utils.getIndent(1)}'; 1781 String indentNew = '$indentOld${utils.getIndent(1)}';
1780 sb.append(eol); 1782 sb.append(eol);
1781 sb.append(indentNew); 1783 sb.append(indentNew);
1782 newExprSrc = newExprSrc.replaceAll( 1784 newExprSrc = newExprSrc.replaceAll(
1783 new RegExp("^$indentOld", multiLine: true), "$indentNew"); 1785 new RegExp("^$indentOld", multiLine: true), "$indentNew");
1784 newExprSrc += ",$eol$indentOld"; 1786 newExprSrc += ",$eol$indentOld";
1785 } 1787 }
1786 sb.startPosition('CHILD'); 1788 sb.startPosition('CHILD');
1787 sb.append('child'); 1789 sb.append('child');
1788 sb.endPosition(); 1790 sb.endPosition();
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
2549 class _SimpleIdentifierRecursiveAstVisitor extends RecursiveAstVisitor { 2551 class _SimpleIdentifierRecursiveAstVisitor extends RecursiveAstVisitor {
2550 final _SimpleIdentifierVisitor visitor; 2552 final _SimpleIdentifierVisitor visitor;
2551 2553
2552 _SimpleIdentifierRecursiveAstVisitor(this.visitor); 2554 _SimpleIdentifierRecursiveAstVisitor(this.visitor);
2553 2555
2554 @override 2556 @override
2555 visitSimpleIdentifier(SimpleIdentifier node) { 2557 visitSimpleIdentifier(SimpleIdentifier node) {
2556 visitor(node); 2558 visitor(node);
2557 } 2559 }
2558 } 2560 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/assist_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698