Skip to content

Commit 11e7932

Browse files
authored
fix(61258): Renaming namespace with const enum doesn't update enum references (#61263)
1 parent 38b78b7 commit 11e7932

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

src/services/findAllReferences.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,7 @@ export namespace Core {
13021302
const symbol = node && skipPastExportOrImportSpecifierOrUnion(originalSymbol, node, checker, /*useLocalSymbolForExportSpecifier*/ !isForRenameWithPrefixAndSuffixText(options)) || originalSymbol;
13031303

13041304
// Compute the meaning from the location and the symbol it references
1305-
const searchMeaning = node ? getIntersectingMeaningFromDeclarations(node, symbol) : SemanticMeaning.All;
1305+
const searchMeaning = node && options.use !== FindReferencesUse.Rename ? getIntersectingMeaningFromDeclarations(node, symbol) : SemanticMeaning.All;
13061306
const result: SymbolAndEntries[] = [];
13071307
const state = new State(sourceFiles, sourceFilesSet, node ? getSpecialSearchKind(node) : SpecialSearchKind.None, checker, cancellationToken, searchMeaning, options, result);
13081308

tests/baselines/reference/findAllRefs_importType_exportEquals.baseline.jsonc

+3-3
Original file line numberDiff line numberDiff line change
@@ -477,16 +477,16 @@
477477
// === findRenameLocations ===
478478
// === /a.ts ===
479479
// <|type /*RENAME*/[|TRENAME|] = number;|>
480-
// namespace T {
480+
// <|namespace [|TRENAME|] {
481481
// export type U = string;
482-
// }
482+
// }|>
483483
// <|export = [|TRENAME|];|>
484484

485485

486486

487487
// === findRenameLocations ===
488488
// === /a.ts ===
489-
// type T = number;
489+
// <|type [|TRENAME|] = number;|>
490490
// <|namespace /*RENAME*/[|TRENAME|] {
491491
// export type U = string;
492492
// }|>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// === findRenameLocations ===
2+
// === /tests/cases/fourslash/renameNamespace.ts ===
3+
// <|namespace /*RENAME*/[|NSRENAME|] {
4+
// export const enum E {
5+
// A = 'a'
6+
// }
7+
// }|>
8+
//
9+
// const a: [|NSRENAME|].E = [|NSRENAME|].E.A;
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
////namespace /**/NS {
4+
//// export const enum E {
5+
//// A = 'a'
6+
//// }
7+
////}
8+
////
9+
////const a: NS.E = NS.E.A;
10+
11+
verify.baselineRename("", { });

0 commit comments

Comments
 (0)