Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/services/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Comment on lines +95 to +99
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rename was bailing because it was calling getMeaningFromLocation on the import specifier’s identifier, and it was making it all the way to the bottom of the function, returning SemanticMeaning.Value. Seems like identifier serving as an import alias should be SemanticMeaning.All.

return SemanticMeaning.All;
}
else if (isInRightSideOfInternalImportEqualsDeclaration(node)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*====== /tests/cases/fourslash/canada.ts ======*/

export interface [|RENAME|] {}

/*====== /tests/cases/fourslash/dry.ts ======*/

import { RENAME as Ale } from './canada';
9 changes: 9 additions & 0 deletions tests/cases/fourslash/renameImportSpecifierPropertyName.ts
Original file line number Diff line number Diff line change
@@ -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("", {});