Index: pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart |
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart |
index 579b7b8662c16a1b621dddba7de8b6008a459b3e..59ae61a2630ac5970382432c1c6c8b388a388521 100644 |
--- a/pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart |
+++ b/pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart |
@@ -14,6 +14,7 @@ import 'package:analysis_server/src/services/completion/dart/utilities.dart'; |
import 'package:analysis_server/src/services/correction/flutter_util.dart'; |
import 'package:analysis_server/src/utilities/documentation.dart'; |
import 'package:analyzer/dart/ast/ast.dart'; |
+import 'package:analyzer/dart/ast/token.dart'; |
import 'package:analyzer/dart/element/element.dart'; |
import 'package:analyzer/src/generated/utilities_dart.dart'; |
@@ -251,6 +252,7 @@ class ArgListContributor extends DartCompletionContributor { |
if (appendColon) { |
completion += ': '; |
} |
+ int selectionOffset = completion.length; |
if (appendComma) { |
completion += ','; |
} |
@@ -258,7 +260,7 @@ class ArgListContributor extends DartCompletionContributor { |
CompletionSuggestionKind.NAMED_ARGUMENT, |
DART_RELEVANCE_NAMED_PARAMETER, |
completion, |
- completion.length, |
+ selectionOffset, |
0, |
false, |
false, |
@@ -305,7 +307,10 @@ class ArgListContributor extends DartCompletionContributor { |
} else if (_isInsertingToArgListWithNoSynthetic(request)) { |
_addDefaultParamSuggestions(parameters, true); |
} else if (_isInsertingToArgListWithSynthetic(request)) { |
- _addDefaultParamSuggestions(parameters); |
+ var entity = request.target.entity; |
+ bool followedByComma = |
+ entity is AstNode && entity.endToken.next.type == TokenType.COMMA; |
Brian Wilkerson
2017/04/26 20:53:40
Should this / does this need to handle the case wh
Brian Wilkerson
2017/04/27 16:13:50
I don't know whether there *are* any use cases, bu
danrubel
2017/04/27 16:27:26
I don't know and if it is not today then it might
pquitslund
2017/04/27 17:09:54
Done.
|
+ _addDefaultParamSuggestions(parameters, !followedByComma); |
} |
} |