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

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

Issue 3001413002: Remove uses of the old plugin model from the analysis server (Closed)
Patch Set: Created 3 years, 4 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:analysis_server/src/provisional/completion/completion_core.dart' 7 import 'package:analysis_server/src/provisional/completion/completion_core.dart'
8 show CompletionContributor, CompletionRequest; 8 show CompletionContributor, CompletionRequest;
9 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart'; 9 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart';
10 import 'package:analysis_server/src/provisional/completion/dart/completion_plugi n.dart';
11 import 'package:analysis_server/src/services/completion/completion_core.dart'; 10 import 'package:analysis_server/src/services/completion/completion_core.dart';
12 import 'package:analysis_server/src/services/completion/completion_performance.d art'; 11 import 'package:analysis_server/src/services/completion/completion_performance.d art';
12 import 'package:analysis_server/src/services/completion/dart/arglist_contributor .dart';
13 import 'package:analysis_server/src/services/completion/dart/combinator_contribu tor.dart';
13 import 'package:analysis_server/src/services/completion/dart/common_usage_sorter .dart'; 14 import 'package:analysis_server/src/services/completion/dart/common_usage_sorter .dart';
14 import 'package:analysis_server/src/services/completion/dart/contribution_sorter .dart'; 15 import 'package:analysis_server/src/services/completion/dart/contribution_sorter .dart';
16 import 'package:analysis_server/src/services/completion/dart/field_formal_contri butor.dart';
17 import 'package:analysis_server/src/services/completion/dart/imported_reference_ contributor.dart';
18 import 'package:analysis_server/src/services/completion/dart/inherited_reference _contributor.dart';
19 import 'package:analysis_server/src/services/completion/dart/keyword_contributor .dart';
20 import 'package:analysis_server/src/services/completion/dart/label_contributor.d art';
21 import 'package:analysis_server/src/services/completion/dart/library_member_cont ributor.dart';
22 import 'package:analysis_server/src/services/completion/dart/library_prefix_cont ributor.dart';
23 import 'package:analysis_server/src/services/completion/dart/local_constructor_c ontributor.dart';
24 import 'package:analysis_server/src/services/completion/dart/local_library_contr ibutor.dart';
25 import 'package:analysis_server/src/services/completion/dart/local_reference_con tributor.dart';
26 import 'package:analysis_server/src/services/completion/dart/named_constructor_c ontributor.dart';
27 import 'package:analysis_server/src/services/completion/dart/static_member_contr ibutor.dart';
28 import 'package:analysis_server/src/services/completion/dart/type_member_contrib utor.dart';
29 import 'package:analysis_server/src/services/completion/dart/uri_contributor.dar t';
30 import 'package:analysis_server/src/services/completion/dart/variable_name_contr ibutor.dart';
15 import 'package:analyzer/dart/ast/ast.dart'; 31 import 'package:analyzer/dart/ast/ast.dart';
16 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; 32 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
17 import 'package:analyzer/dart/ast/token.dart'; 33 import 'package:analyzer/dart/ast/token.dart';
18 import 'package:analyzer/dart/element/element.dart'; 34 import 'package:analyzer/dart/element/element.dart';
19 import 'package:analyzer/dart/element/type.dart'; 35 import 'package:analyzer/dart/element/type.dart';
20 import 'package:analyzer/file_system/file_system.dart'; 36 import 'package:analyzer/file_system/file_system.dart';
21 import 'package:analyzer/src/dart/analysis/driver.dart'; 37 import 'package:analyzer/src/dart/analysis/driver.dart';
22 import 'package:analyzer/src/dart/ast/token.dart'; 38 import 'package:analyzer/src/dart/ast/token.dart';
23 import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult; 39 import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult;
24 import 'package:analyzer/src/generated/source.dart'; 40 import 'package:analyzer/src/generated/source.dart';
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 74
59 ReplacementRange range = 75 ReplacementRange range =
60 new ReplacementRange.compute(dartRequest.offset, dartRequest.target); 76 new ReplacementRange.compute(dartRequest.offset, dartRequest.target);
61 (request as CompletionRequestImpl) 77 (request as CompletionRequestImpl)
62 ..replacementOffset = range.offset 78 ..replacementOffset = range.offset
63 ..replacementLength = range.length; 79 ..replacementLength = range.length;
64 80
65 // Request Dart specific completions from each contributor 81 // Request Dart specific completions from each contributor
66 Map<String, CompletionSuggestion> suggestionMap = 82 Map<String, CompletionSuggestion> suggestionMap =
67 <String, CompletionSuggestion>{}; 83 <String, CompletionSuggestion>{};
68 for (DartCompletionContributor contributor 84 List<DartCompletionContributor> contributors = <DartCompletionContributor>[
69 in dartCompletionPlugin.contributors) { 85 new ArgListContributor(),
86 new CombinatorContributor(),
87 new FieldFormalContributor(),
88 new ImportedReferenceContributor(),
89 new InheritedReferenceContributor(),
90 new KeywordContributor(),
91 new LabelContributor(),
92 new LibraryMemberContributor(),
93 new LibraryPrefixContributor(),
94 new LocalConstructorContributor(),
95 new LocalLibraryContributor(),
96 new LocalReferenceContributor(),
97 new NamedConstructorContributor(),
98 // Revisit this contributor and these tests
99 // once DartChangeBuilder API has solidified.
100 // new OverrideContributor(),
101 new StaticMemberContributor(),
102 new TypeMemberContributor(),
103 new UriContributor(),
104 new VariableNameContributor()
105 ];
106 for (DartCompletionContributor contributor in contributors) {
70 String contributorTag = 107 String contributorTag =
71 'DartCompletionManager - ${contributor.runtimeType}'; 108 'DartCompletionManager - ${contributor.runtimeType}';
72 performance.logStartTime(contributorTag); 109 performance.logStartTime(contributorTag);
73 List<CompletionSuggestion> contributorSuggestions = 110 List<CompletionSuggestion> contributorSuggestions =
74 await contributor.computeSuggestions(dartRequest); 111 await contributor.computeSuggestions(dartRequest);
75 performance.logElapseTime(contributorTag); 112 performance.logElapseTime(contributorTag);
76 request.checkAborted(); 113 request.checkAborted();
77 114
78 for (CompletionSuggestion newSuggestion in contributorSuggestions) { 115 for (CompletionSuggestion newSuggestion in contributorSuggestions) {
79 var oldSuggestion = suggestionMap.putIfAbsent( 116 var oldSuggestion = suggestionMap.putIfAbsent(
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 if (start <= requestOffset && requestOffset <= end) { 327 if (start <= requestOffset && requestOffset <= end) {
291 // Replacement range for import URI 328 // Replacement range for import URI
292 return new ReplacementRange(start, end - start); 329 return new ReplacementRange(start, end - start);
293 } 330 }
294 } 331 }
295 } 332 }
296 } 333 }
297 return new ReplacementRange(requestOffset, 0); 334 return new ReplacementRange(requestOffset, 0);
298 } 335 }
299 } 336 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/server/driver.dart ('k') | pkg/analysis_server/lib/src/socket_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698