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

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

Issue 1410893002: Disable completion in comment text. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
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 c9d0c6f05011c57d740be47685ace02a3a42ff59..332a7e85e1e81f96bc898465cf718a0b39a1ee36 100644
--- a/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart
@@ -22,7 +22,9 @@ const AWAIT = 'await';
class KeywordContributor extends DartCompletionContributor {
@override
bool computeFast(DartCompletionRequest request) {
- request.target.containingNode.accept(new _KeywordVisitor(request));
+ if (!request.target.isCommentText) {
+ request.target.containingNode.accept(new _KeywordVisitor(request));
+ }
return true;
}
@@ -33,7 +35,7 @@ class KeywordContributor extends DartCompletionContributor {
}
/**
- * A vistor for generating keyword suggestions.
+ * A visitor for generating keyword suggestions.
*/
class _KeywordVisitor extends GeneralizingAstVisitor {
final DartCompletionRequest request;
@@ -176,9 +178,9 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
@override
visitFormalParameterList(FormalParameterList node) {
- AstNode constructorDecl =
+ AstNode constructorDeclaration =
node.getAncestor((p) => p is ConstructorDeclaration);
- if (constructorDecl != null) {
+ if (constructorDeclaration != null) {
_addSuggestions([Keyword.THIS]);
}
}

Powered by Google App Engine
This is Rietveld 408576698