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

Side by Side Diff: pkg/analysis_server/lib/src/domain_completion.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) 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:analysis_server/protocol/protocol.dart'; 7 import 'package:analysis_server/protocol/protocol.dart';
8 import 'package:analysis_server/protocol/protocol_constants.dart'; 8 import 'package:analysis_server/protocol/protocol_constants.dart';
9 import 'package:analysis_server/protocol/protocol_generated.dart'; 9 import 'package:analysis_server/protocol/protocol_generated.dart';
10 import 'package:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
11 import 'package:analysis_server/src/collections.dart'; 11 import 'package:analysis_server/src/collections.dart';
12 import 'package:analysis_server/src/domain_abstract.dart'; 12 import 'package:analysis_server/src/domain_abstract.dart';
13 import 'package:analysis_server/src/plugin/plugin_manager.dart'; 13 import 'package:analysis_server/src/plugin/plugin_manager.dart';
14 import 'package:analysis_server/src/provisional/completion/completion_core.dart' ; 14 import 'package:analysis_server/src/provisional/completion/completion_core.dart' ;
15 import 'package:analysis_server/src/services/completion/completion_core.dart'; 15 import 'package:analysis_server/src/services/completion/completion_core.dart';
16 import 'package:analysis_server/src/services/completion/completion_performance.d art'; 16 import 'package:analysis_server/src/services/completion/completion_performance.d art';
17 import 'package:analysis_server/src/services/completion/dart/completion_manager. dart';
17 import 'package:analyzer/src/dart/analysis/driver.dart'; 18 import 'package:analyzer/src/dart/analysis/driver.dart';
18 import 'package:analyzer/src/generated/source.dart'; 19 import 'package:analyzer/src/generated/source.dart';
19 import 'package:analyzer_plugin/protocol/protocol.dart' as plugin; 20 import 'package:analyzer_plugin/protocol/protocol.dart' as plugin;
20 import 'package:analyzer_plugin/protocol/protocol_common.dart'; 21 import 'package:analyzer_plugin/protocol/protocol_common.dart';
21 import 'package:analyzer_plugin/protocol/protocol_constants.dart' as plugin; 22 import 'package:analyzer_plugin/protocol/protocol_constants.dart' as plugin;
22 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; 23 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
23 24
24 /** 25 /**
25 * Instances of the class [CompletionDomainHandler] implement a [RequestHandler] 26 * Instances of the class [CompletionDomainHandler] implement a [RequestHandler]
26 * that handles requests in the completion domain. 27 * that handles requests in the completion domain.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 if (driver != null) { 84 if (driver != null) {
84 requestParams = new plugin.CompletionGetSuggestionsParams(file, offset); 85 requestParams = new plugin.CompletionGetSuggestionsParams(file, offset);
85 pluginFutures = server.pluginManager 86 pluginFutures = server.pluginManager
86 .broadcastRequest(requestParams, contextRoot: driver.contextRoot); 87 .broadcastRequest(requestParams, contextRoot: driver.contextRoot);
87 } 88 }
88 // 89 //
89 // Compute completions generated by server. 90 // Compute completions generated by server.
90 // 91 //
91 List<CompletionSuggestion> suggestions = <CompletionSuggestion>[]; 92 List<CompletionSuggestion> suggestions = <CompletionSuggestion>[];
92 if (request.result != null) { 93 if (request.result != null) {
93 Iterable<CompletionContributor> newContributors =
94 server.serverPlugin.completionContributors;
95
96 const COMPUTE_SUGGESTIONS_TAG = 'computeSuggestions'; 94 const COMPUTE_SUGGESTIONS_TAG = 'computeSuggestions';
97 performance.logStartTime(COMPUTE_SUGGESTIONS_TAG); 95 performance.logStartTime(COMPUTE_SUGGESTIONS_TAG);
98 96
99 for (CompletionContributor contributor in newContributors) { 97 CompletionContributor contributor = new DartCompletionManager();
100 String contributorTag = 'computeSuggestions - ${contributor 98 String contributorTag = 'computeSuggestions - ${contributor
101 .runtimeType}'; 99 .runtimeType}';
102 performance.logStartTime(contributorTag); 100 performance.logStartTime(contributorTag);
103 try { 101 try {
104 suggestions.addAll(await contributor.computeSuggestions(request)); 102 suggestions.addAll(await contributor.computeSuggestions(request));
105 } on AbortCompletion { 103 } on AbortCompletion {
106 suggestions.clear(); 104 suggestions.clear();
107 break;
108 }
109 performance.logElapseTime(contributorTag);
110 } 105 }
106 performance.logElapseTime(contributorTag);
111 performance.logElapseTime(COMPUTE_SUGGESTIONS_TAG); 107 performance.logElapseTime(COMPUTE_SUGGESTIONS_TAG);
112 } 108 }
113 // TODO (danrubel) if request is obsolete (processAnalysisRequest returns 109 // TODO (danrubel) if request is obsolete (processAnalysisRequest returns
114 // false) then send empty results 110 // false) then send empty results
115 111
116 // 112 //
117 // Add the fixes produced by plugins to the server-generated fixes. 113 // Add the fixes produced by plugins to the server-generated fixes.
118 // 114 //
119 if (pluginFutures != null) { 115 if (pluginFutures != null) {
120 List<plugin.Response> responses = await waitForResponses(pluginFutures, 116 List<plugin.Response> responses = await waitForResponses(pluginFutures,
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 final int replacementOffset; 289 final int replacementOffset;
294 290
295 /** 291 /**
296 * The suggested completions. 292 * The suggested completions.
297 */ 293 */
298 final List<CompletionSuggestion> suggestions; 294 final List<CompletionSuggestion> suggestions;
299 295
300 CompletionResult( 296 CompletionResult(
301 this.replacementOffset, this.replacementLength, this.suggestions); 297 this.replacementOffset, this.replacementLength, this.suggestions);
302 } 298 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/domain_analysis.dart ('k') | pkg/analysis_server/lib/src/domains/analysis/navigation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698