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

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

Issue 1910263004: Code completion progress part one of fix to https://github.com/dart-lang/sdk/issues/24254, addition… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: comment from danr, rebase with master Created 4 years, 8 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/dart/optype_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/dart/optype.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/optype.dart b/pkg/analysis_server/lib/src/services/completion/dart/optype.dart
index 837fde41589e150dbbee6c81e9ed3ac4b5ce636a..ffbbcdb5a43f8443e7e3b4b7a4f5d2fc48d4f711 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/optype.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/optype.dart
@@ -88,6 +88,11 @@ class OpType {
bool includeCaseLabelSuggestions = false;
/**
+ * Indicates whether variable names should be suggested.
+ */
+ bool includeVarNameSuggestions = false;
+
+ /**
* Indicates whether the completion location is in the body of a static method.
*/
bool inStaticMethodBody = false;
@@ -122,18 +127,18 @@ class OpType {
/**
* Indicate whether only type names should be suggested
*/
- bool get includeOnlyTypeNameSuggestions =>
- includeTypeNameSuggestions &&
- !includeNamedArgumentSuggestions &&
+ bool get includeOnlyNamedArgumentSuggestions =>
+ includeNamedArgumentSuggestions &&
+ !includeTypeNameSuggestions &&
!includeReturnValueSuggestions &&
!includeVoidReturnSuggestions;
/**
* Indicate whether only type names should be suggested
*/
- bool get includeOnlyNamedArgumentSuggestions =>
- includeNamedArgumentSuggestions &&
- !includeTypeNameSuggestions &&
+ bool get includeOnlyTypeNameSuggestions =>
+ includeTypeNameSuggestions &&
+ !includeNamedArgumentSuggestions &&
!includeReturnValueSuggestions &&
!includeVoidReturnSuggestions;
}
@@ -380,6 +385,10 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
optype.includeReturnValueSuggestions = true;
optype.includeTypeNameSuggestions = true;
}
+ if ((token.isSynthetic || token.lexeme == ';') &&
+ node.expression is Identifier) {
+ optype.includeVarNameSuggestions = true;
+ }
}
}
@@ -798,9 +807,12 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
@override
void visitVariableDeclarationList(VariableDeclarationList node) {
- if ((node.keyword == null || node.keyword.lexeme != 'var') &&
- (node.type == null || identical(entity, node.type))) {
- optype.includeTypeNameSuggestions = true;
+ if (node.keyword == null || node.keyword.lexeme != 'var') {
+ if (node.type == null || identical(entity, node.type)) {
+ optype.includeTypeNameSuggestions = true;
+ } else if (node.type != null && entity is VariableDeclaration) {
+ optype.includeVarNameSuggestions = true;
+ }
}
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/dart/optype_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698