File tree Expand file tree Collapse file tree 16 files changed +93
-83
lines changed
analysis_server_plugin/lib
test/src/utilities/extensions Expand file tree Collapse file tree 16 files changed +93
-83
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import 'package:analyzer/dart/element/element2.dart' hide ElementLocation;
1313import 'package:analyzer/dart/element/type.dart' ;
1414import 'package:analyzer/source/source_range.dart' ;
1515import 'package:analyzer/src/dart/element/element.dart' ;
16- import 'package:analyzer/src/ utilities/extensions/ast.dart' ;
16+ import 'package:analyzer/utilities/extensions/ast.dart' ;
1717
1818/// A lazy computer for Type Hierarchies.
1919///
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import 'package:analyzer/dart/element/element2.dart';
1010import 'package:analyzer/dart/element/type.dart' ;
1111import 'package:analyzer/src/dart/ast/element_locator.dart' ;
1212import 'package:analyzer/src/dartdoc/dartdoc_directive_info.dart' ;
13- import 'package:analyzer/src/ utilities/extensions/ast.dart' ;
13+ import 'package:analyzer/utilities/extensions/ast.dart' ;
1414
1515/// A computer for the signature at the specified offset of a Dart
1616/// [CompilationUnit] .
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ import 'package:analyzer/dart/element/element2.dart';
99import 'package:analyzer/src/dart/ast/ast.dart' ;
1010import 'package:analyzer/src/dart/element/element.dart' ;
1111import 'package:analyzer/src/dartdoc/dartdoc_directive_info.dart' ;
12- import 'package:analyzer/src/utilities/extensions/ast.dart' ;
1312import 'package:analyzer/src/utilities/extensions/flutter.dart' ;
13+ import 'package:analyzer/utilities/extensions/ast.dart' ;
1414
1515/// Information about the arguments and parameters for an invocation.
1616typedef EditableInvocationInfo =
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import 'package:analysis_server/src/lsp/error_or.dart';
88import 'package:analysis_server/src/lsp/handlers/handlers.dart' ;
99import 'package:analysis_server/src/lsp/mapping.dart' ;
1010import 'package:analyzer/src/dart/ast/ast.dart' as ast;
11- import 'package:analyzer/src/ utilities/extensions/ast.dart' ;
11+ import 'package:analyzer/utilities/extensions/ast.dart' ;
1212
1313class AugmentationHandler
1414 extends SharedMessageHandler <TextDocumentPositionParams , Location ?> {
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import 'package:analysis_server/src/lsp/error_or.dart';
88import 'package:analysis_server/src/lsp/handlers/handlers.dart' ;
99import 'package:analysis_server/src/lsp/mapping.dart' ;
1010import 'package:analyzer/src/dart/ast/ast.dart' as ast;
11- import 'package:analyzer/src/ utilities/extensions/ast.dart' ;
11+ import 'package:analyzer/utilities/extensions/ast.dart' ;
1212
1313class AugmentedHandler
1414 extends SharedMessageHandler <TextDocumentPositionParams , Location ?> {
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ import 'package:analyzer/dart/analysis/results.dart';
1212import 'package:analyzer/dart/element/element2.dart' ;
1313import 'package:analyzer/src/dart/ast/ast.dart' ;
1414import 'package:analyzer/src/dart/ast/element_locator.dart' ;
15- import 'package:analyzer/src/utilities/extensions/ast.dart' ;
1615import 'package:analyzer/src/utilities/extensions/results.dart' ;
16+ import 'package:analyzer/utilities/extensions/ast.dart' ;
1717
1818class ImportsHandler
1919 extends SharedMessageHandler <TextDocumentPositionParams , List <Location >?> {
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import 'package:analyzer/dart/ast/ast.dart';
1111import 'package:analyzer/dart/element/element2.dart' ;
1212import 'package:analyzer/src/dart/analysis/session.dart' ;
1313import 'package:analyzer/src/dart/ast/element_locator.dart' ;
14- import 'package:analyzer/src/ utilities/extensions/ast.dart' ;
14+ import 'package:analyzer/utilities/extensions/ast.dart' ;
1515
1616class SuperHandler
1717 extends SharedMessageHandler <TextDocumentPositionParams , Location ?> {
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ import 'package:analyzer/dart/element/element2.dart';
1111import 'package:analyzer/dart/element/type.dart' ;
1212import 'package:analyzer/src/dart/analysis/session_helper.dart' ;
1313import 'package:analyzer/src/dart/ast/extensions.dart' ;
14- import 'package:analyzer/src/utilities/extensions/ast.dart' ;
1514import 'package:analyzer/src/utilities/extensions/flutter.dart' ;
15+ import 'package:analyzer/utilities/extensions/ast.dart' ;
1616import 'package:dart_style/dart_style.dart' ;
1717
1818/// The result of [WidgetDescriptions.setPropertyValue] invocation.
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ import 'package:analyzer/source/source.dart';
1212import 'package:analyzer/source/source_range.dart' ;
1313import 'package:analyzer/src/dart/ast/ast.dart' ;
1414import 'package:analyzer/src/dart/ast/extensions.dart' ;
15- import 'package:analyzer/src/dart/ast/utilities.dart' ;
1615import 'package:analyzer/src/dart/scanner/reader.dart' ;
1716import 'package:analyzer/src/dart/scanner/scanner.dart' ;
1817import 'package:analyzer/src/utilities/extensions/string.dart' ;
18+ import 'package:analyzer/utilities/extensions/ast.dart' ;
1919import 'package:analyzer_plugin/src/utilities/string_utilities.dart' ;
2020import 'package:analyzer_plugin/utilities/range_factory.dart' ;
2121
@@ -57,7 +57,7 @@ final class CorrectionUtils {
5757 String get twoIndents => _twoIndents;
5858
5959 /// Returns the [AstNode] that encloses the given [offset] .
60- AstNode ? findNode (int offset) => NodeLocator (offset). searchWithin (_unit );
60+ AstNode ? findNode (int offset) => _unit. nodeCovering (offset : offset );
6161
6262 /// Skips whitespace characters and single EOL on the right from [index] .
6363 ///
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import 'package:analyzer/src/dart/element/element.dart';
2727import 'package:analyzer/src/dart/element/inheritance_manager3.dart' ;
2828import 'package:analyzer/src/dart/element/type.dart' ;
2929import 'package:analyzer/src/utilities/extensions/ast.dart' ;
30+ import 'package:analyzer/utilities/extensions/ast.dart' ;
3031import 'package:analyzer_plugin/utilities/assist/assist.dart' ;
3132import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart' ;
3233import 'package:analyzer_plugin/utilities/fixes/fixes.dart' ;
@@ -294,9 +295,8 @@ final class CorrectionProducerContext {
294295 int selectionOffset = - 1 ,
295296 int selectionLength = 0 ,
296297 }) {
297- var selectionEnd = selectionOffset + selectionLength;
298- var locator = NodeLocator (selectionOffset, selectionEnd);
299- var node = locator.searchWithin (unitResult.unit);
298+ var node = unitResult.unit
299+ .nodeCovering (offset: selectionOffset, length: selectionLength);
300300 node ?? = unitResult.unit;
301301
302302 var token = _tokenAt (node, selectionOffset) ?? node.beginToken;
You can’t perform that action at this time.
0 commit comments