Skip to content

Commit 81a7acc

Browse files
FMorschelCommit Queue
authored andcommitted
[DAS] Fixes different aliased imports same element
[email protected] Fixes #59584 Change-Id: I7038827ad0414e73e6af8f37f90d56cfcb6e76af Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397000 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]> Auto-Submit: Felipe Morschel <[email protected]>
1 parent de9f149 commit 81a7acc

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

pkg/analysis_server/lib/src/lsp/handlers/custom/handler_imports.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ class ImportsHandler
140140
for (var directive in unit.directives.whereType<ImportDirective>()) {
141141
var import = directive.libraryImport;
142142
if (import == null) continue;
143+
var importPrefix = directive.prefix?.name;
144+
if (importPrefix != prefix) continue;
143145

144146
var importedElement =
145147
prefix == null

pkg/analysis_server/test/lsp/import_test.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,20 @@ Rando^m? r;''');
317317
);
318318
}
319319

320+
Future<void> test_import_multiple() async {
321+
await _verifyGoToImports(
322+
TestCode.parse('''
323+
import 'dart:async' as import1;
324+
import 'dart:async' as import2;
325+
/*[0*/import 'dart:async';/*0]*/
326+
/*[1*/import 'dart:core';/*1]*/
327+
import 'dart:math';
328+
329+
Futur^e<void>? f;
330+
'''),
331+
);
332+
}
333+
320334
Future<void> test_import_part() async {
321335
var otherFileUri = Uri.file(join(projectFolderPath, 'lib', 'other.dart'));
322336
var main = TestCode.parse('''

0 commit comments

Comments
 (0)