Skip to content

Commit 3810c2f

Browse files
authored
Fix rename for type symbols imported as a different name (microsoft#37745)
* Add failing test * Fix getMeaningFromLocation for imports * Only the name of an ImportEqualsDeclaration counts * Commit baseline
1 parent 72a0411 commit 3810c2f

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/services/utilities.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ namespace ts {
9292
if (node.kind === SyntaxKind.SourceFile) {
9393
return SemanticMeaning.Value;
9494
}
95-
else if (node.parent.kind === SyntaxKind.ExportAssignment || node.parent.kind === SyntaxKind.ExternalModuleReference) {
95+
else if (node.parent.kind === SyntaxKind.ExportAssignment
96+
|| node.parent.kind === SyntaxKind.ExternalModuleReference
97+
|| node.parent.kind === SyntaxKind.ImportSpecifier
98+
|| node.parent.kind === SyntaxKind.ImportClause
99+
|| isImportEqualsDeclaration(node.parent) && node === node.parent.name) {
96100
return SemanticMeaning.All;
97101
}
98102
else if (isInRightSideOfInternalImportEqualsDeclaration(node)) {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*====== /tests/cases/fourslash/canada.ts ======*/
2+
3+
export interface [|RENAME|] {}
4+
5+
/*====== /tests/cases/fourslash/dry.ts ======*/
6+
7+
import { RENAME as Ale } from './canada';
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @Filename: canada.ts
4+
////export interface /**/Ginger {}
5+
6+
// @Filename: dry.ts
7+
////import { Ginger as Ale } from './canada';
8+
9+
verify.baselineRename("", {});

0 commit comments

Comments
 (0)