| 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;
|
| + }
|
| }
|
| }
|
|
|
|
|