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

Side by Side Diff: pkg/analysis_server/lib/src/services/refactoring/move_file.dart

Issue 1135073004: Fix for 'Create part' Quick Fix. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
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.refactoring.move_file; 5 library services.src.refactoring.move_file;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol_server.dart' hide Element; 9 import 'package:analysis_server/src/protocol_server.dart' hide Element;
10 import 'package:analysis_server/src/services/correction/status.dart'; 10 import 'package:analysis_server/src/services/correction/status.dart';
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 @override 85 @override
86 bool requiresPreview() => false; 86 bool requiresPreview() => false;
87 87
88 /** 88 /**
89 * Computes the URI to use to reference [newFile] from [reference]. 89 * Computes the URI to use to reference [newFile] from [reference].
90 */ 90 */
91 String _computeNewUri(SourceReference reference) { 91 String _computeNewUri(SourceReference reference) {
92 String refDir = pathContext.dirname(reference.file); 92 String refDir = pathContext.dirname(reference.file);
93 // try to keep package: URI 93 // try to keep package: URI
94 if (_isPackageReference(reference)) { 94 if (_isPackageReference(reference)) {
95 Source newSource = new NonExistingSource(newFile, UriKind.FILE_URI); 95 Source newSource = new NonExistingSource(
96 newFile, pathos.toUri(newFile), UriKind.FILE_URI);
96 Uri restoredUri = context.sourceFactory.restoreUri(newSource); 97 Uri restoredUri = context.sourceFactory.restoreUri(newSource);
97 if (restoredUri != null) { 98 if (restoredUri != null) {
98 return restoredUri.toString(); 99 return restoredUri.toString();
99 } 100 }
100 } 101 }
101 // if no package: URI, prepare relative 102 // if no package: URI, prepare relative
102 return _getRelativeUri(newFile, refDir); 103 return _getRelativeUri(newFile, refDir);
103 } 104 }
104 105
105 Future<SourceChange> _createFileChange() async { 106 Future<SourceChange> _createFileChange() async {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 } 231 }
231 } 232 }
232 } 233 }
233 234
234 void _updateUriReferences(List<UriReferencedElement> elements) { 235 void _updateUriReferences(List<UriReferencedElement> elements) {
235 for (UriReferencedElement element in elements) { 236 for (UriReferencedElement element in elements) {
236 _updateUriReference(element); 237 _updateUriReference(element);
237 } 238 }
238 } 239 }
239 } 240 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/util.dart ('k') | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698