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

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

Issue 1276843007: suggest "deferred as" rather than "deferred" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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_contributor_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_contributor.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart b/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart
index 33dfa582edeafd2d34cab6c3e9cdd7616e9da28f..6cbfb014ee2f966fffed9d4c5bc626ccc2bb925a 100644
--- a/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart
@@ -355,12 +355,24 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
}
void _addImportDirectiveKeywords(ImportDirective node) {
- if (node.asKeyword == null) {
+ bool hasDeferredKeyword = node.deferredKeyword != null;
+ bool hasAsKeyword = node.asKeyword != null;
+ if (!hasAsKeyword) {
_addSuggestion(Keyword.AS, DART_RELEVANCE_HIGH);
- if (node.deferredKeyword == null) {
+ }
+ if (!hasDeferredKeyword) {
+ if (!hasAsKeyword) {
+ _addSuggestion2('deferred as', relevance: DART_RELEVANCE_HIGH);
+ } else if (entity == node.asKeyword) {
_addSuggestion(Keyword.DEFERRED, DART_RELEVANCE_HIGH);
}
}
+ if (!hasDeferredKeyword || hasAsKeyword) {
+ if (node.combinators.isEmpty) {
+ _addSuggestion2('show', relevance: DART_RELEVANCE_HIGH);
+ _addSuggestion2('hide', relevance: DART_RELEVANCE_HIGH);
+ }
+ }
}
void _addStatementKeywords(AstNode node) {
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/keyword_contributor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698