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

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

Issue 2138843002: 'Import library' fixes should use the same 'addLibraryImports' implementation as the fixes where im… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 | « pkg/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | 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.util; 5 library services.src.correction.util;
6 6
7 import 'dart:math'; 7 import 'dart:math';
8 8
9 import 'package:analysis_server/plugin/protocol/protocol.dart' 9 import 'package:analysis_server/plugin/protocol/protocol.dart'
10 show SourceChange, SourceEdit; 10 show SourceChange, SourceEdit;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // if still at the beginning of the file, skip shebang and line comments 54 // if still at the beginning of the file, skip shebang and line comments
55 if (offset == 0) { 55 if (offset == 0) {
56 CorrectionUtils_InsertDesc desc = libraryUtils.getInsertDescTop(); 56 CorrectionUtils_InsertDesc desc = libraryUtils.getInsertDescTop();
57 offset = desc.offset; 57 offset = desc.offset;
58 prefix = desc.prefix; 58 prefix = desc.prefix;
59 suffix = desc.suffix + eol; 59 suffix = desc.suffix + eol;
60 } 60 }
61 } 61 }
62 // insert imports 62 // insert imports
63 for (LibraryElement library in libraries) { 63 for (LibraryElement library in libraries) {
64 String importPath = getLibrarySourceUri(targetLibrary, library.source); 64 String importUri = getLibrarySourceUri(targetLibrary, library.source);
65 String importCode = "${prefix}import '$importPath';$suffix"; 65 String importCode = "${prefix}import '$importUri';$suffix";
66 doSourceChange_addElementEdit( 66 doSourceChange_addElementEdit(
67 change, targetLibrary, new SourceEdit(offset, 0, importCode)); 67 change, targetLibrary, new SourceEdit(offset, 0, importCode));
68 } 68 }
69 } 69 }
70 70
71 /** 71 /**
72 * @return <code>true</code> if given [List]s are identical at given position. 72 * @return <code>true</code> if given [List]s are identical at given position.
73 */ 73 */
74 bool allListsIdentical(List<List> lists, int position) { 74 bool allListsIdentical(List<List> lists, int position) {
75 Object element = lists[0][position]; 75 Object element = lists[0][position];
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 _InvertedCondition expr, int newOperatorPrecedence) { 1499 _InvertedCondition expr, int newOperatorPrecedence) {
1500 if (expr._precedence < newOperatorPrecedence) { 1500 if (expr._precedence < newOperatorPrecedence) {
1501 return "(${expr._source})"; 1501 return "(${expr._source})";
1502 } 1502 }
1503 return expr._source; 1503 return expr._source;
1504 } 1504 }
1505 1505
1506 static _InvertedCondition _simple(String source) => 1506 static _InvertedCondition _simple(String source) =>
1507 new _InvertedCondition(2147483647, source); 1507 new _InvertedCondition(2147483647, source);
1508 } 1508 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698