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

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

Issue 2879273002: Make server use the common protocol classes (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
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;
6
7 import 'dart:async'; 5 import 'dart:async';
8 6
9 import 'package:analysis_server/protocol/protocol.dart'; 7 import 'package:analysis_server/protocol/protocol.dart';
10 import 'package:analysis_server/protocol/protocol_generated.dart'; 8 import 'package:analysis_server/protocol/protocol_generated.dart';
11 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
12 import 'package:analysis_server/src/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
13 import 'package:analysis_server/src/domain_abstract.dart'; 11 import 'package:analysis_server/src/domain_abstract.dart';
14 import 'package:analysis_server/src/plugin/plugin_manager.dart'; 12 import 'package:analysis_server/src/plugin/plugin_manager.dart';
15 import 'package:analysis_server/src/plugin/result_converter.dart';
16 import 'package:analysis_server/src/provisional/completion/completion_core.dart' ; 13 import 'package:analysis_server/src/provisional/completion/completion_core.dart' ;
17 import 'package:analysis_server/src/services/completion/completion_core.dart'; 14 import 'package:analysis_server/src/services/completion/completion_core.dart';
18 import 'package:analysis_server/src/services/completion/completion_performance.d art'; 15 import 'package:analysis_server/src/services/completion/completion_performance.d art';
19 import 'package:analyzer/src/dart/analysis/driver.dart'; 16 import 'package:analyzer/src/dart/analysis/driver.dart';
20 import 'package:analyzer/src/generated/source.dart'; 17 import 'package:analyzer/src/generated/source.dart';
21 import 'package:analyzer_plugin/protocol/protocol.dart' as plugin; 18 import 'package:analyzer_plugin/protocol/protocol.dart' as plugin;
19 import 'package:analyzer_plugin/protocol/protocol_common.dart';
22 import 'package:analyzer_plugin/protocol/protocol_constants.dart' as plugin; 20 import 'package:analyzer_plugin/protocol/protocol_constants.dart' as plugin;
23 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; 21 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
24 22
25 /** 23 /**
26 * Instances of the class [CompletionDomainHandler] implement a [RequestHandler] 24 * Instances of the class [CompletionDomainHandler] implement a [RequestHandler]
27 * that handles requests in the completion domain. 25 * that handles requests in the completion domain.
28 */ 26 */
29 class CompletionDomainHandler extends AbstractRequestHandler { 27 class CompletionDomainHandler extends AbstractRequestHandler {
30 /** 28 /**
31 * The maximum number of performance measurements to keep. 29 * The maximum number of performance measurements to keep.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 109
112 // TODO (danrubel) if request is obsolete (processAnalysisRequest returns 110 // TODO (danrubel) if request is obsolete (processAnalysisRequest returns
113 // false) then send empty results 111 // false) then send empty results
114 112
115 // 113 //
116 // Add the fixes produced by plugins to the server-generated fixes. 114 // Add the fixes produced by plugins to the server-generated fixes.
117 // 115 //
118 if (pluginFutures != null) { 116 if (pluginFutures != null) {
119 List<plugin.Response> responses = await waitForResponses(pluginFutures, 117 List<plugin.Response> responses = await waitForResponses(pluginFutures,
120 requestParameters: requestParams); 118 requestParameters: requestParams);
121 ResultConverter converter = new ResultConverter();
122 for (plugin.Response response in responses) { 119 for (plugin.Response response in responses) {
123 plugin.CompletionGetSuggestionsResult result = 120 plugin.CompletionGetSuggestionsResult result =
124 new plugin.CompletionGetSuggestionsResult.fromResponse(response); 121 new plugin.CompletionGetSuggestionsResult.fromResponse(response);
125 suggestions 122 suggestions.addAll(result.results);
126 .addAll(result.results.map(converter.convertCompletionSuggestion));
127 } 123 }
128 } 124 }
129 // 125 //
130 // Return the result. 126 // Return the result.
131 // 127 //
132 return new CompletionResult( 128 return new CompletionResult(
133 request.replacementOffset, request.replacementLength, suggestions); 129 request.replacementOffset, request.replacementLength, suggestions);
134 } 130 }
135 131
136 @override 132 @override
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 final int replacementOffset; 287 final int replacementOffset;
292 288
293 /** 289 /**
294 * The suggested completions. 290 * The suggested completions.
295 */ 291 */
296 final List<CompletionSuggestion> suggestions; 292 final List<CompletionSuggestion> suggestions;
297 293
298 CompletionResult( 294 CompletionResult(
299 this.replacementOffset, this.replacementLength, this.suggestions); 295 this.replacementOffset, this.replacementLength, this.suggestions);
300 } 296 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698