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

Side by Side Diff: pkg/analysis_server/lib/src/services/completion/uri_contributor.dart

Issue 1329463002: rename ImportUriContributor to UriContributor (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge and address comment Created 5 years, 3 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.completion.contributor.dart.importuri; 5 library services.completion.contributor.dart.importuri;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:core' hide Resource; 8 import 'dart:core' hide Resource;
9 9
10 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart'; 10 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart';
11 import 'package:analyzer/file_system/file_system.dart'; 11 import 'package:analyzer/file_system/file_system.dart';
12 import 'package:analyzer/src/generated/ast.dart'; 12 import 'package:analyzer/src/generated/ast.dart';
13 import 'package:analyzer/src/generated/sdk.dart'; 13 import 'package:analyzer/src/generated/sdk.dart';
14 import 'package:analyzer/src/generated/source.dart'; 14 import 'package:analyzer/src/generated/source.dart';
15 import 'package:path/path.dart' show posix; 15 import 'package:path/path.dart' show posix;
16 import 'package:path/src/context.dart'; 16 import 'package:path/src/context.dart';
17 17
18 import '../../protocol_server.dart' 18 import '../../protocol_server.dart'
19 show CompletionSuggestion, CompletionSuggestionKind; 19 show CompletionSuggestion, CompletionSuggestionKind;
20 20
21 /** 21 /**
22 * A contributor for calculating uri suggestions 22 * A contributor for calculating uri suggestions
23 * for import and part directives. 23 * for import and part directives.
24 */ 24 */
25 class ImportUriContributor extends DartCompletionContributor { 25 class UriContributor extends DartCompletionContributor {
26 _ImportUriSuggestionBuilder builder; 26 _UriSuggestionBuilder builder;
27 27
28 @override 28 @override
29 bool computeFast(DartCompletionRequest request) { 29 bool computeFast(DartCompletionRequest request) {
30 builder = new _ImportUriSuggestionBuilder(request); 30 builder = new _UriSuggestionBuilder(request);
31 return builder.computeFast(request.target.containingNode); 31 return builder.computeFast(request.target.containingNode);
32 } 32 }
33 33
34 @override 34 @override
35 Future<bool> computeFull(DartCompletionRequest request) { 35 Future<bool> computeFull(DartCompletionRequest request) {
36 return new Future.value(false); 36 return new Future.value(false);
37 } 37 }
38 } 38 }
39 39
40 class _ImportUriSuggestionBuilder extends SimpleAstVisitor { 40 class _UriSuggestionBuilder extends SimpleAstVisitor {
41 final DartCompletionRequest request; 41 final DartCompletionRequest request;
42 42
43 _ImportUriSuggestionBuilder(this.request); 43 _UriSuggestionBuilder(this.request);
44 44
45 bool computeFast(AstNode node) { 45 bool computeFast(AstNode node) {
46 node.accept(this); 46 node.accept(this);
47 return true; 47 return true;
48 } 48 }
49 49
50 @override 50 @override
51 visitImportDirective(ImportDirective node) { 51 visitImportDirective(ImportDirective node) {
52 StringLiteral uri = node.uri; 52 StringLiteral uri = node.uri;
53 if (uri is SimpleStringLiteral) { 53 if (uri is SimpleStringLiteral) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 request.addSuggestion(new CompletionSuggestion( 175 request.addSuggestion(new CompletionSuggestion(
176 CompletionSuggestionKind.IMPORT, 176 CompletionSuggestionKind.IMPORT,
177 relevance, 177 relevance,
178 completion, 178 completion,
179 completion.length, 179 completion.length,
180 0, 180 0,
181 false, 181 false,
182 false)); 182 false));
183 } 183 }
184 } 184 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698