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

Side by Side Diff: pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart

Issue 2727343002: Calculate text ranges for default args. (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library services.completion.dart.suggestion.builder; 5 library services.completion.dart.suggestion.builder;
6 6
7 import 'package:analysis_server/src/protocol_server.dart' as protocol; 7 import 'package:analysis_server/src/protocol_server.dart' as protocol;
8 import 'package:analysis_server/src/protocol_server.dart' 8 import 'package:analysis_server/src/protocol_server.dart'
9 hide Element, ElementKind; 9 hide Element, ElementKind;
10 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart'; 10 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart';
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 Iterable<ParameterElement> requiredParameters = element.parameters.where( 75 Iterable<ParameterElement> requiredParameters = element.parameters.where(
76 (ParameterElement param) => 76 (ParameterElement param) =>
77 param.parameterKind == ParameterKind.REQUIRED); 77 param.parameterKind == ParameterKind.REQUIRED);
78 suggestion.requiredParameterCount = requiredParameters.length; 78 suggestion.requiredParameterCount = requiredParameters.length;
79 79
80 Iterable<ParameterElement> namedParameters = element.parameters.where( 80 Iterable<ParameterElement> namedParameters = element.parameters.where(
81 (ParameterElement param) => param.parameterKind == ParameterKind.NAMED); 81 (ParameterElement param) => param.parameterKind == ParameterKind.NAMED);
82 suggestion.hasNamedParameters = namedParameters.isNotEmpty; 82 suggestion.hasNamedParameters = namedParameters.isNotEmpty;
83 83
84 suggestion.defaultArgumentListString = 84 addDefaultArgDetails(suggestion, requiredParameters, namedParameters);
85 buildDefaultArgList(requiredParameters, namedParameters);
86 } 85 }
87 if (importForSource != null) { 86 if (importForSource != null) {
88 String srcPath = path.dirname(importForSource.fullName); 87 String srcPath = path.dirname(importForSource.fullName);
89 LibraryElement libElem = element.library; 88 LibraryElement libElem = element.library;
90 if (libElem != null) { 89 if (libElem != null) {
91 Source libSource = libElem.source; 90 Source libSource = libElem.source;
92 if (libSource != null) { 91 if (libSource != null) {
93 UriKind uriKind = libSource.uriKind; 92 UriKind uriKind = libSource.uriKind;
94 if (uriKind == UriKind.DART_URI) { 93 if (uriKind == UriKind.DART_URI) {
95 suggestion.importUri = libSource.uri.toString(); 94 suggestion.importUri = libSource.uri.toString();
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 @override 282 @override
284 visitTopLevelVariableElement(TopLevelVariableElement element) { 283 visitTopLevelVariableElement(TopLevelVariableElement element) {
285 if (!typesOnly) { 284 if (!typesOnly) {
286 int relevance = element.library == containingLibrary 285 int relevance = element.library == containingLibrary
287 ? DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE 286 ? DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE
288 : DART_RELEVANCE_DEFAULT; 287 : DART_RELEVANCE_DEFAULT;
289 addSuggestion(element, relevance: relevance); 288 addSuggestion(element, relevance: relevance);
290 } 289 }
291 } 290 }
292 } 291 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698