diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 522577f9d8f87..a2ed0feb795a7 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -1302,7 +1302,7 @@ export namespace Core { const symbol = node && skipPastExportOrImportSpecifierOrUnion(originalSymbol, node, checker, /*useLocalSymbolForExportSpecifier*/ !isForRenameWithPrefixAndSuffixText(options)) || originalSymbol; // Compute the meaning from the location and the symbol it references - const searchMeaning = node ? getIntersectingMeaningFromDeclarations(node, symbol) : SemanticMeaning.All; + const searchMeaning = node && options.use !== FindReferencesUse.Rename ? getIntersectingMeaningFromDeclarations(node, symbol) : SemanticMeaning.All; const result: SymbolAndEntries[] = []; const state = new State(sourceFiles, sourceFilesSet, node ? getSpecialSearchKind(node) : SpecialSearchKind.None, checker, cancellationToken, searchMeaning, options, result); diff --git a/tests/baselines/reference/findAllRefs_importType_exportEquals.baseline.jsonc b/tests/baselines/reference/findAllRefs_importType_exportEquals.baseline.jsonc index bd7279c9ebebc..0b2a8f523d40a 100644 --- a/tests/baselines/reference/findAllRefs_importType_exportEquals.baseline.jsonc +++ b/tests/baselines/reference/findAllRefs_importType_exportEquals.baseline.jsonc @@ -477,16 +477,16 @@ // === findRenameLocations === // === /a.ts === // <|type /*RENAME*/[|TRENAME|] = number;|> -// namespace T { +// <|namespace [|TRENAME|] { // export type U = string; -// } +// }|> // <|export = [|TRENAME|];|> // === findRenameLocations === // === /a.ts === -// type T = number; +// <|type [|TRENAME|] = number;|> // <|namespace /*RENAME*/[|TRENAME|] { // export type U = string; // }|> diff --git a/tests/baselines/reference/renameNamespace.baseline.jsonc b/tests/baselines/reference/renameNamespace.baseline.jsonc new file mode 100644 index 0000000000000..b85fa55d02dcc --- /dev/null +++ b/tests/baselines/reference/renameNamespace.baseline.jsonc @@ -0,0 +1,9 @@ +// === findRenameLocations === +// === /tests/cases/fourslash/renameNamespace.ts === +// <|namespace /*RENAME*/[|NSRENAME|] { +// export const enum E { +// A = 'a' +// } +// }|> +// +// const a: [|NSRENAME|].E = [|NSRENAME|].E.A; \ No newline at end of file diff --git a/tests/cases/fourslash/renameNamespace.ts b/tests/cases/fourslash/renameNamespace.ts new file mode 100644 index 0000000000000..4c6471fd7cee0 --- /dev/null +++ b/tests/cases/fourslash/renameNamespace.ts @@ -0,0 +1,11 @@ +/// + +////namespace /**/NS { +//// export const enum E { +//// A = 'a' +//// } +////} +//// +////const a: NS.E = NS.E.A; + +verify.baselineRename("", { });