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

Side by Side Diff: pkg/analysis_server/lib/completion/dart/completion_target.dart

Issue 1347283005: refactor ContributionSorter to use new API (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 import 'package:analyzer/src/generated/ast.dart'; 1 import 'package:analyzer/src/generated/ast.dart';
2 import 'package:analyzer/src/generated/element.dart'; 2 import 'package:analyzer/src/generated/element.dart';
3 import 'package:analyzer/src/generated/scanner.dart'; 3 import 'package:analyzer/src/generated/scanner.dart';
4 import 'package:analyzer/src/generated/utilities_dart.dart'; 4 import 'package:analyzer/src/generated/utilities_dart.dart';
5 5
6 int _computeArgIndex(AstNode containingNode, Object entity) { 6 int _computeArgIndex(AstNode containingNode, Object entity) {
7 var argList = containingNode; 7 var argList = containingNode;
8 if (argList is ArgumentList) { 8 if (argList is ArgumentList) {
9 NodeList<Expression> args = argList.arguments; 9 NodeList<Expression> args = argList.arguments;
10 for (int index = 0; index < args.length; ++index) { 10 for (int index = 0; index < args.length; ++index) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 * The entity which the completed text will replace (or which will be 87 * The entity which the completed text will replace (or which will be
88 * displaced once the completed text is inserted). This may be an AstNode or 88 * displaced once the completed text is inserted). This may be an AstNode or
89 * a Token, or it may be null if the cursor is after all tokens in the file. 89 * a Token, or it may be null if the cursor is after all tokens in the file.
90 * 90 *
91 * Usually, the entity won't be the first child of the [containingNode] (this 91 * Usually, the entity won't be the first child of the [containingNode] (this
92 * is a consequence of placing the completion target as high in the tree as 92 * is a consequence of placing the completion target as high in the tree as
93 * possible). However, there is one exception: when the cursor is inside of 93 * possible). However, there is one exception: when the cursor is inside of
94 * a multi-character token which is not a keyword or identifier (e.g. a 94 * a multi-character token which is not a keyword or identifier (e.g. a
95 * comment, or a token like "+=", the entity will be always be the token. 95 * comment, or a token like "+=", the entity will be always be the token.
96 */ 96 */
97 final Object entity; 97 final Object entity;
Brian Wilkerson 2015/09/18 18:59:29 I'm not thrilled with needing to use Object, but I
danrubel 2015/09/18 20:03:51 A new marker interface implemented by both AstNode
98 98
99 /** 99 /**
100 * If the target is an argument in an [ArgumentList], then this is the index 100 * If the target is an argument in an [ArgumentList], then this is the index
101 * of the argument in the list, otherwise this is `null`. 101 * of the argument in the list, otherwise this is `null`.
102 */ 102 */
103 final int argIndex; 103 final int argIndex;
104 104
105 /** 105 /**
106 * Compute the appropriate [CompletionTarget] for the given [offset] within 106 * Compute the appropriate [CompletionTarget] for the given [offset] within
107 * the [compilationUnit]. 107 * the [compilationUnit].
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 if (param.parameterKind == ParameterKind.NAMED) { 347 if (param.parameterKind == ParameterKind.NAMED) {
348 // TODO(danrubel) handle named parameters 348 // TODO(danrubel) handle named parameters
349 return false; 349 return false;
350 } else { 350 } else {
351 return paramType is FunctionType || paramType is FunctionTypeAlias; 351 return paramType is FunctionType || paramType is FunctionTypeAlias;
352 } 352 }
353 } 353 }
354 return false; 354 return false;
355 } 355 }
356 } 356 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698