| Index: pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart
|
| diff --git a/pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart b/pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart
|
| similarity index 95%
|
| rename from pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart
|
| rename to pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart
|
| index 840dbaf99bdb0f70526c649f591ff1e36353a7aa..9df4db13ce226e5cc7734e1e553e6e80699f3d33 100644
|
| --- a/pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart
|
| +++ b/pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| @@ -8,33 +8,6 @@ import 'package:analyzer/dart/element/element.dart';
|
| import 'package:analyzer/dart/element/type.dart';
|
| import 'package:analyzer/src/generated/utilities_dart.dart';
|
|
|
| -int _computeArgIndex(AstNode containingNode, Object entity) {
|
| - var argList = containingNode;
|
| - if (argList is NamedExpression) {
|
| - entity = argList;
|
| - argList = argList.parent;
|
| - }
|
| - if (argList is ArgumentList) {
|
| - NodeList<Expression> args = argList.arguments;
|
| - for (int index = 0; index < args.length; ++index) {
|
| - if (entity == args[index]) {
|
| - return index;
|
| - }
|
| - }
|
| - if (args.isEmpty) {
|
| - return 0;
|
| - }
|
| - if (entity == argList.rightParenthesis) {
|
| - // Parser ignores trailing commas
|
| - if (argList.rightParenthesis.previous?.lexeme == ',') {
|
| - return args.length;
|
| - }
|
| - return args.length - 1;
|
| - }
|
| - }
|
| - return null;
|
| -}
|
| -
|
| /**
|
| * A CompletionTarget represents an edge in the parse tree which connects an
|
| * AST node (the [containingNode] of the completion) to one of its children
|
| @@ -340,6 +313,33 @@ class CompletionTarget {
|
| return false;
|
| }
|
|
|
| + static int _computeArgIndex(AstNode containingNode, Object entity) {
|
| + var argList = containingNode;
|
| + if (argList is NamedExpression) {
|
| + entity = argList;
|
| + argList = argList.parent;
|
| + }
|
| + if (argList is ArgumentList) {
|
| + NodeList<Expression> args = argList.arguments;
|
| + for (int index = 0; index < args.length; ++index) {
|
| + if (entity == args[index]) {
|
| + return index;
|
| + }
|
| + }
|
| + if (args.isEmpty) {
|
| + return 0;
|
| + }
|
| + if (entity == argList.rightParenthesis) {
|
| + // Parser ignores trailing commas
|
| + if (argList.rightParenthesis.previous?.lexeme == ',') {
|
| + return args.length;
|
| + }
|
| + return args.length - 1;
|
| + }
|
| + }
|
| + return null;
|
| + }
|
| +
|
| /**
|
| * Determine if the offset is contained in a preceding comment token
|
| * and return that token, otherwise return `null`.
|
|
|