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

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

Issue 666473002: update keyword suggestion priorities (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 2 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 | pkg/analysis_server/test/services/completion/keyword_computer_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/completion/keyword_computer.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/keyword_computer.dart b/pkg/analysis_server/lib/src/services/completion/keyword_computer.dart
index 4091f9f2828bef5b4fe5f042313f94d1c0663f31..714c483c71304d5cc5477e8a5fa50539923f3cfc 100644
--- a/pkg/analysis_server/lib/src/services/completion/keyword_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/keyword_computer.dart
@@ -87,12 +87,12 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
// Very simplistic suggestion because analyzer will warn if
// the extends / with / implements keywords are out of order
if (node.extendsClause == null) {
- _addSuggestion(Keyword.EXTENDS);
+ _addSuggestion(Keyword.EXTENDS, CompletionRelevance.HIGH);
} else if (node.withClause == null) {
- _addSuggestion(Keyword.WITH);
+ _addSuggestion(Keyword.WITH, CompletionRelevance.HIGH);
}
if (node.implementsClause == null) {
- _addSuggestion(Keyword.IMPLEMENTS);
+ _addSuggestion(Keyword.IMPLEMENTS, CompletionRelevance.HIGH);
}
}
@@ -120,16 +120,18 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
if (firstDirective is! LibraryDirective) {
if (firstDirective != null) {
if (request.offset <= firstDirective.offset) {
- _addSuggestions([Keyword.LIBRARY]);
+ _addSuggestions([Keyword.LIBRARY], CompletionRelevance.HIGH);
}
} else {
if (request.offset <= startOfDeclarations) {
- _addSuggestions([Keyword.LIBRARY]);
+ _addSuggestions([Keyword.LIBRARY], CompletionRelevance.HIGH);
}
}
}
if (request.offset <= startOfDeclarations) {
- _addSuggestions([Keyword.EXPORT, Keyword.IMPORT, Keyword.PART]);
+ _addSuggestions(
+ [Keyword.EXPORT, Keyword.IMPORT, Keyword.PART],
+ CompletionRelevance.HIGH);
}
if (request.offset >= endOfDirectives) {
_addSuggestions(
@@ -139,7 +141,8 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
Keyword.CONST,
Keyword.FINAL,
Keyword.TYPEDEF,
- Keyword.VAR]);
+ Keyword.VAR],
+ CompletionRelevance.HIGH);
}
}
@@ -164,12 +167,13 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
}
}
- void _addSuggestion(Keyword keyword) {
+ void _addSuggestion(Keyword keyword, [CompletionRelevance relevance =
+ CompletionRelevance.DEFAULT]) {
String completion = keyword.syntax;
request.suggestions.add(
new CompletionSuggestion(
CompletionSuggestionKind.KEYWORD,
- CompletionRelevance.DEFAULT,
+ relevance,
completion,
completion.length,
0,
@@ -177,9 +181,10 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
false));
}
- void _addSuggestions(List<Keyword> keywords) {
+ void _addSuggestions(List<Keyword> keywords, [CompletionRelevance relevance =
+ CompletionRelevance.DEFAULT]) {
keywords.forEach((Keyword keyword) {
- _addSuggestion(keyword);
+ _addSuggestion(keyword, relevance);
});
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/keyword_computer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698