Fix rename for type symbols imported as a different name (#37745)

* Add failing test

* Fix getMeaningFromLocation for imports

* Only the name of an ImportEqualsDeclaration counts

* Commit baseline
This commit is contained in:
Andrew Branch 2020-04-02 08:06:19 -08:00 committed by GitHub
parent 72a0411776
commit 3810c2fe6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 1 deletions

View file

@ -92,7 +92,11 @@ namespace ts {
if (node.kind === SyntaxKind.SourceFile) {
return SemanticMeaning.Value;
}
else if (node.parent.kind === SyntaxKind.ExportAssignment || node.parent.kind === SyntaxKind.ExternalModuleReference) {
else if (node.parent.kind === SyntaxKind.ExportAssignment
|| node.parent.kind === SyntaxKind.ExternalModuleReference
|| node.parent.kind === SyntaxKind.ImportSpecifier
|| node.parent.kind === SyntaxKind.ImportClause
|| isImportEqualsDeclaration(node.parent) && node === node.parent.name) {
return SemanticMeaning.All;
}
else if (isInRightSideOfInternalImportEqualsDeclaration(node)) {

View file

@ -0,0 +1,7 @@
/*====== /tests/cases/fourslash/canada.ts ======*/
export interface [|RENAME|] {}
/*====== /tests/cases/fourslash/dry.ts ======*/
import { RENAME as Ale } from './canada';

View file

@ -0,0 +1,9 @@
/// <reference path="fourslash.ts" />
// @Filename: canada.ts
////export interface /**/Ginger {}
// @Filename: dry.ts
////import { Ginger as Ale } from './canada';
verify.baselineRename("", {});