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

Side by Side Diff: pkg/analysis_server/lib/src/domain_completion.dart

Issue 2876793006: improve code completion abort request tests (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/domain_completion_test.dart » ('j') | 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 domain.completion; 5 library domain.completion;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/protocol/protocol.dart'; 9 import 'package:analysis_server/protocol/protocol.dart';
10 import 'package:analysis_server/protocol/protocol_generated.dart'; 10 import 'package:analysis_server/protocol/protocol_generated.dart';
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 * Subclasses should override this method, append at least one result 71 * Subclasses should override this method, append at least one result
72 * to the [controller], and close the controller stream once complete. 72 * to the [controller], and close the controller stream once complete.
73 */ 73 */
74 Future<CompletionResult> computeSuggestions(CompletionRequestImpl request, 74 Future<CompletionResult> computeSuggestions(CompletionRequestImpl request,
75 CompletionGetSuggestionsParams params) async { 75 CompletionGetSuggestionsParams params) async {
76 // 76 //
77 // Allow plugins to start computing fixes. 77 // Allow plugins to start computing fixes.
78 // 78 //
79 Map<PluginInfo, Future<plugin.Response>> pluginFutures; 79 Map<PluginInfo, Future<plugin.Response>> pluginFutures;
80 plugin.CompletionGetSuggestionsParams requestParams; 80 plugin.CompletionGetSuggestionsParams requestParams;
81 if (server.options.enableNewAnalysisDriver) { 81 String file = params.file;
82 String file = params.file; 82 int offset = params.offset;
83 int offset = params.offset; 83 AnalysisDriver driver = server.getAnalysisDriver(file);
84 AnalysisDriver driver = server.getAnalysisDriver(file); 84 if (driver != null) {
85 if (driver != null) { 85 requestParams = new plugin.CompletionGetSuggestionsParams(file, offset);
86 requestParams = new plugin.CompletionGetSuggestionsParams(file, offset); 86 pluginFutures = server.pluginManager
87 pluginFutures = server.pluginManager 87 .broadcastRequest(requestParams, contextRoot: driver.contextRoot);
88 .broadcastRequest(requestParams, contextRoot: driver.contextRoot);
89 }
90 } 88 }
91 // 89 //
92 // Compute completions generated by server. 90 // Compute completions generated by server.
93 // 91 //
94 Iterable<CompletionContributor> newContributors = 92 Iterable<CompletionContributor> newContributors =
95 server.serverPlugin.completionContributors; 93 server.serverPlugin.completionContributors;
96 List<CompletionSuggestion> suggestions = <CompletionSuggestion>[]; 94 List<CompletionSuggestion> suggestions = <CompletionSuggestion>[];
97 95
98 const COMPUTE_SUGGESTIONS_TAG = 'computeSuggestions'; 96 const COMPUTE_SUGGESTIONS_TAG = 'computeSuggestions';
99 performance.logStartTime(COMPUTE_SUGGESTIONS_TAG); 97 performance.logStartTime(COMPUTE_SUGGESTIONS_TAG);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 final int replacementOffset; 291 final int replacementOffset;
294 292
295 /** 293 /**
296 * The suggested completions. 294 * The suggested completions.
297 */ 295 */
298 final List<CompletionSuggestion> suggestions; 296 final List<CompletionSuggestion> suggestions;
299 297
300 CompletionResult( 298 CompletionResult(
301 this.replacementOffset, this.replacementLength, this.suggestions); 299 this.replacementOffset, this.replacementLength, this.suggestions);
302 } 300 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/domain_completion_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698