Skip to content

Commit 4fb58be

Browse files
Andarista-tarasyuk
andauthored
Port "fix(61258): Renaming namespace with const enum doesn't update enum references" (#1811)
Co-authored-by: "Oleksandr T." <[email protected]>
1 parent 45dcb56 commit 4fb58be

9 files changed

+19
-59
lines changed

internal/ls/findallreferences.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,10 @@ func getReferencedSymbolsForSymbol(originalSymbol *ast.Symbol, node *ast.Node, s
11921192
symbol := core.Coalesce(skipPastExportOrImportSpecifierOrUnion(originalSymbol, node, checker /*useLocalSymbolForExportSpecifier*/, !isForRenameWithPrefixAndSuffixText(options)), originalSymbol)
11931193

11941194
// Compute the meaning from the location and the symbol it references
1195-
searchMeaning := getIntersectingMeaningFromDeclarations(node, symbol, ast.SemanticMeaningAll)
1195+
searchMeaning := ast.SemanticMeaningAll
1196+
if options.use != referenceUseRename {
1197+
searchMeaning = getIntersectingMeaningFromDeclarations(node, symbol, ast.SemanticMeaningAll)
1198+
}
11961199
state := newState(sourceFiles, sourceFilesSet, node, checker /*, cancellationToken*/, searchMeaning, options)
11971200

11981201
var exportSpecifier *ast.Node

testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameAlias3.baseline.jsonc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
// === /renameAlias3.ts ===
33
// module SomeModule { export class /*RENAME*/[|SomeClassRENAME|] { } }
44
// import M = SomeModule;
5-
// import C = M.SomeClass;
5+
// import C = M.[|SomeClassRENAME|];
66

77

88

99
// === findRenameLocations ===
1010
// === /renameAlias3.ts ===
11-
// module SomeModule { export class SomeClass { } }
11+
// module SomeModule { export class [|SomeClassRENAME|] { } }
1212
// import M = SomeModule;
1313
// import C = M./*RENAME*/[|SomeClassRENAME|];

testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameAlias3.baseline.jsonc.diff

Lines changed: 0 additions & 17 deletions
This file was deleted.

testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameAliasExternalModule3.baseline.jsonc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@
33
// module SomeModule { export class /*RENAME*/[|SomeClassRENAME|] { } }
44
// export = SomeModule;
55

6+
// === /b.ts ===
7+
// import M = require("./a");
8+
// import C = M.[|SomeClassRENAME|];
9+
610

711

812
// === findRenameLocations ===
13+
// === /a.ts ===
14+
// module SomeModule { export class [|SomeClassRENAME|] { } }
15+
// export = SomeModule;
16+
917
// === /b.ts ===
1018
// import M = require("./a");
1119
// import C = M./*RENAME*/[|SomeClassRENAME|];

testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameAliasExternalModule3.baseline.jsonc.diff

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
// === findRenameLocations ===
22
// === /canada.ts ===
3-
// export interface /*RENAME*/[|GingerRENAME|] {}
3+
// export interface /*RENAME*/[|GingerRENAME|] {}
4+
5+
// === /dry.ts ===
6+
// import { [|GingerRENAME|] as Ale } from './canada';

testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportSpecifierPropertyName.baseline.jsonc.diff

Lines changed: 0 additions & 9 deletions
This file was deleted.

testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameNamespace.baseline.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
// }
77
// }
88
//
9-
// const a: [|NSRENAME|].E = NS.E.A;
9+
// const a: [|NSRENAME|].E = [|NSRENAME|].E.A;

testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameNamespace.baseline.jsonc.diff

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)