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

Unified Diff: pkg/analysis_server/lib/src/domain_completion.dart

Issue 2913833002: Allow replacementOffset and Length overriding (Closed)
Patch Set: Add check on plugin results 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/domain_completion.dart
diff --git a/pkg/analysis_server/lib/src/domain_completion.dart b/pkg/analysis_server/lib/src/domain_completion.dart
index a00617f22f630dbfa41cec09a5e82fe4a60abbf3..cffeb010f253ee7053df179f3eba7ad6bd562e21 100644
--- a/pkg/analysis_server/lib/src/domain_completion.dart
+++ b/pkg/analysis_server/lib/src/domain_completion.dart
@@ -121,7 +121,19 @@ class CompletionDomainHandler extends AbstractRequestHandler {
for (plugin.Response response in responses) {
plugin.CompletionGetSuggestionsResult result =
new plugin.CompletionGetSuggestionsResult.fromResponse(response);
- suggestions.addAll(result.results);
+ if (result.results != null && result.results.isNotEmpty) {
+ if (suggestions.isEmpty) {
+ request.replacementOffset = result.replacementOffset;
+ request.replacementLength = result.replacementLength;
+ } else if (request.replacementOffset != result.replacementOffset &&
+ request.replacementLength != result.replacementLength) {
+ server.instrumentationService
+ .logError('Plugin completion-results dropped due to conflicting'
+ ' replacement offset/length: ${result.toJson()}');
+ continue;
+ }
+ suggestions.addAll(result.results);
+ }
}
}
//
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698