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

Unified Diff: pkg/analysis_server/lib/src/services/completion/local_computer.dart

Issue 1001143002: remove duplicate completion suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 9 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
Index: pkg/analysis_server/lib/src/services/completion/local_computer.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/local_computer.dart b/pkg/analysis_server/lib/src/services/completion/local_computer.dart
index 4f6b1389a0989b14102341de7ea09c4b6b8f8dfa..243d01207d4cd8c6a2b8b512d57e6e6a6c0ff8b6 100644
--- a/pkg/analysis_server/lib/src/services/completion/local_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/local_computer.dart
@@ -5,6 +5,7 @@
library services.completion.computer.dart.local;
import 'dart:async';
+import 'dart:collection';
import 'package:analysis_server/src/protocol.dart' as protocol
show Element, ElementKind;
@@ -428,6 +429,7 @@ class _LabelVisitor extends LocalDeclarationVisitor {
class _LocalVisitor extends LocalDeclarationVisitor {
final DartCompletionRequest request;
final OpType optype;
+ HashSet<String> completions = new HashSet();
_LocalVisitor(this.request, int offset, this.optype) : super(offset);
@@ -666,7 +668,10 @@ class _LocalVisitor extends LocalDeclarationVisitor {
bool isDeprecated, int defaultRelevance, {ClassDeclaration classDecl}) {
if (id != null) {
String completion = id.name;
- if (completion != null && completion.length > 0 && completion != '_') {
+ if (completion != null &&
+ completion.length > 0 &&
+ completion != '_' &&
+ completions.add(completion)) {
CompletionSuggestion suggestion = new CompletionSuggestion(
CompletionSuggestionKind.INVOCATION,
isDeprecated ? DART_RELEVANCE_LOW : defaultRelevance, completion,
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/imported_computer.dart ('k') | pkg/analysis_server/test/completion_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698