From c729a1a4deb44a9e3e9583d842298dc5a38bfbb3 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Tue, 9 Dec 2025 08:43:36 -0800 Subject: [PATCH 1/3] add test --- .../fourslash/tests/statefindallrefs_test.go | 74 ++++ ...efsReExportInMultiProjectSolution.baseline | 350 ++++++++++++++++++ 2 files changed, 424 insertions(+) create mode 100644 testdata/baselines/reference/fourslash/state/findAllRefsReExportInMultiProjectSolution.baseline diff --git a/internal/fourslash/tests/statefindallrefs_test.go b/internal/fourslash/tests/statefindallrefs_test.go index b2d72886f9..9862f0e1a8 100644 --- a/internal/fourslash/tests/statefindallrefs_test.go +++ b/internal/fourslash/tests/statefindallrefs_test.go @@ -1041,6 +1041,80 @@ import * as shared from "../../shared/dist" } } +func TestFindAllRefsReExportInMultiProjectSolution(t *testing.T) { + t.Parallel() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + // Repro from https://github.com/mjames-c/tsgo-playground + // Tests that find-all-references can follow re-exports across projects + content := ` +// @stateBaseline: true +// @Filename: /tsconfig.base.json +{ + "compilerOptions": { + "rootDir": ".", + "outDir": "target", + "module": "ESNext", + "moduleResolution": "bundler", + "composite": true, + "declaration": true, + "strict": true + }, + "include": [] +} +// @Filename: /tsconfig.json +{ + "extends": "./tsconfig.base.json", + "references": [ + { "path": "project-a" }, + { "path": "project-b" }, + { "path": "project-c" }, + ] +} +// @Filename: /project-a/tsconfig.json +{ + "extends": "../tsconfig.base.json", + "include": ["*"] +} +// @Filename: /project-a/private.ts +export const /*symbolA*/symbolA = 'some-symbol'; +console.log(symbolA); +// @Filename: /project-a/public.ts +export { symbolA } from './private'; +// @Filename: /project-b/tsconfig.json +{ + "extends": "../tsconfig.base.json", + "include": ["*"] +} +// @Filename: /project-b/public.ts +export const /*symbolB*/symbolB = 'symbol-b'; +// @Filename: /project-c/tsconfig.json +{ + "extends": "../tsconfig.base.json", + "include": ["*"], + "references": [ + { "path": "../project-a" }, + { "path": "../project-b" }, + ] +} +// @Filename: /project-c/index.ts +import { symbolB } from '../project-b/public'; +import { /*symbolAUsage*/symbolA } from '../project-a/public'; +console.log(symbolB); +console.log(symbolA); +` + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() + + // Find all refs for symbolA - should find definition in private.ts, re-export in public.ts, and usage in project-c/index.ts + f.VerifyBaselineFindAllReferences(t, "symbolA") + + // Find all refs for symbolB - should find definition and usage (no re-export involved) + f.VerifyBaselineFindAllReferences(t, "symbolB") + + // Find all refs from the usage site - should also work + f.VerifyBaselineFindAllReferences(t, "symbolAUsage") +} + func TestFindAllRefsDeclarationInOtherProject(t *testing.T) { t.Parallel() type testCase struct { diff --git a/testdata/baselines/reference/fourslash/state/findAllRefsReExportInMultiProjectSolution.baseline b/testdata/baselines/reference/fourslash/state/findAllRefsReExportInMultiProjectSolution.baseline new file mode 100644 index 0000000000..8a144e2abc --- /dev/null +++ b/testdata/baselines/reference/fourslash/state/findAllRefsReExportInMultiProjectSolution.baseline @@ -0,0 +1,350 @@ +UseCaseSensitiveFileNames: true +//// [/project-a/private.ts] *new* +export const symbolA = 'some-symbol'; +console.log(symbolA); +//// [/project-a/public.ts] *new* +export { symbolA } from './private'; +//// [/project-a/tsconfig.json] *new* +{ + "extends": "../tsconfig.base.json", + "include": ["*"] +} +//// [/project-b/public.ts] *new* +export const symbolB = 'symbol-b'; +//// [/project-b/tsconfig.json] *new* +{ + "extends": "../tsconfig.base.json", + "include": ["*"] +} +//// [/project-c/index.ts] *new* +import { symbolB } from '../project-b/public'; +import { symbolA } from '../project-a/public'; +console.log(symbolB); +console.log(symbolA); + +//// [/project-c/tsconfig.json] *new* +{ + "extends": "../tsconfig.base.json", + "include": ["*"], + "references": [ + { "path": "../project-a" }, + { "path": "../project-b" }, + ] +} +//// [/tsconfig.base.json] *new* +{ + "compilerOptions": { + "rootDir": ".", + "outDir": "target", + "module": "ESNext", + "moduleResolution": "bundler", + "composite": true, + "declaration": true, + "strict": true + }, + "include": [] +} +//// [/tsconfig.json] *new* +{ + "extends": "./tsconfig.base.json", + "references": [ + { "path": "project-a" }, + { "path": "project-b" }, + { "path": "project-c" }, + ] +} + + +{ + "method": "textDocument/didOpen", + "params": { + "textDocument": { + "uri": "file:///project-a/private.ts", + "languageId": "typescript", + "version": 0, + "text": "export const symbolA = 'some-symbol';\nconsole.log(symbolA);" + } + } +} + +Projects:: + [/project-a/tsconfig.json] *new* + /project-a/private.ts + /project-a/public.ts + [/tsconfig.json] *new* +Open Files:: + [/project-a/private.ts] *new* + /project-a/tsconfig.json (default) +Config:: + [/project-a/tsconfig.json] *new* + RetainingProjects: + /project-a/tsconfig.json + RetainingOpenFiles: + /project-a/private.ts + [/tsconfig.base.json] *new* + RetainingConfigs: + /project-a/tsconfig.json +Config File Names:: + [/project-a/private.ts] *new* + NearestConfigFileName: /project-a/tsconfig.json + Ancestors: + /project-a/tsconfig.json /tsconfig.json + /tsconfig.json + +{ + "method": "textDocument/references", + "params": { + "textDocument": { + "uri": "file:///project-a/private.ts" + }, + "position": { + "line": 0, + "character": 13 + }, + "context": { + "includeDeclaration": true + } + } +} + +Projects:: + [/project-a/tsconfig.json] + /project-a/private.ts + /project-a/public.ts + [/project-c/tsconfig.json] *new* + /project-b/public.ts + /project-a/private.ts + /project-a/public.ts + /project-c/index.ts + [/tsconfig.json] *modified* +Open Files:: + [/project-a/private.ts] *modified* + /project-a/tsconfig.json (default) + /project-c/tsconfig.json *new* +Config:: + [/project-a/tsconfig.json] *modified* + RetainingProjects: *modified* + /project-a/tsconfig.json + /project-c/tsconfig.json *new* + /tsconfig.json *new* + RetainingOpenFiles: + /project-a/private.ts + [/project-b/tsconfig.json] *new* + RetainingProjects: + /project-c/tsconfig.json + /tsconfig.json + [/project-c/tsconfig.json] *new* + RetainingProjects: + /project-c/tsconfig.json + /tsconfig.json + [/tsconfig.base.json] *modified* + RetainingConfigs: *modified* + /project-a/tsconfig.json + /project-b/tsconfig.json *new* + /project-c/tsconfig.json *new* + /tsconfig.json *new* + [/tsconfig.json] *new* + RetainingProjects: + /tsconfig.json + + + + +// === findAllReferences === +// === /project-a/private.ts === +// export const /*FIND ALL REFS*/[|symbolA|] = 'some-symbol'; +// console.log([|symbolA|]); +{ + "method": "textDocument/didOpen", + "params": { + "textDocument": { + "uri": "file:///project-b/public.ts", + "languageId": "typescript", + "version": 0, + "text": "export const symbolB = 'symbol-b';" + } + } +} + +Projects:: + [/project-a/tsconfig.json] + /project-a/private.ts + /project-a/public.ts + [/project-b/tsconfig.json] *new* + /project-b/public.ts + [/project-c/tsconfig.json] + /project-b/public.ts + /project-a/private.ts + /project-a/public.ts + /project-c/index.ts + [/tsconfig.json] +Open Files:: + [/project-a/private.ts] + /project-a/tsconfig.json (default) + /project-c/tsconfig.json + [/project-b/public.ts] *new* + /project-b/tsconfig.json (default) + /project-c/tsconfig.json +Config:: + [/project-a/tsconfig.json] + RetainingProjects: + /project-a/tsconfig.json + /project-c/tsconfig.json + /tsconfig.json + RetainingOpenFiles: + /project-a/private.ts + [/project-b/tsconfig.json] *modified* + RetainingProjects: *modified* + /project-b/tsconfig.json *new* + /project-c/tsconfig.json + /tsconfig.json + RetainingOpenFiles: *modified* + /project-b/public.ts *new* + [/project-c/tsconfig.json] + RetainingProjects: + /project-c/tsconfig.json + /tsconfig.json + [/tsconfig.base.json] + RetainingConfigs: + /project-a/tsconfig.json + /project-b/tsconfig.json + /project-c/tsconfig.json + /tsconfig.json + [/tsconfig.json] + RetainingProjects: + /tsconfig.json +Config File Names:: + [/project-a/private.ts] + NearestConfigFileName: /project-a/tsconfig.json + Ancestors: + /project-a/tsconfig.json /tsconfig.json + /tsconfig.json + [/project-b/public.ts] *new* + NearestConfigFileName: /project-b/tsconfig.json + Ancestors: + /project-b/tsconfig.json /tsconfig.json + /tsconfig.json + +{ + "method": "textDocument/references", + "params": { + "textDocument": { + "uri": "file:///project-b/public.ts" + }, + "position": { + "line": 0, + "character": 13 + }, + "context": { + "includeDeclaration": true + } + } +} + + + + +// === findAllReferences === +// === /project-b/public.ts === +// export const /*FIND ALL REFS*/[|symbolB|] = 'symbol-b'; + +// === /project-c/index.ts === +// import { [|symbolB|] } from '../project-b/public'; +// import { symbolA } from '../project-a/public'; +// console.log([|symbolB|]); +// console.log(symbolA); +// +{ + "method": "textDocument/didOpen", + "params": { + "textDocument": { + "uri": "file:///project-c/index.ts", + "languageId": "typescript", + "version": 0, + "text": "import { symbolB } from '../project-b/public';\nimport { symbolA } from '../project-a/public';\nconsole.log(symbolB);\nconsole.log(symbolA);\n" + } + } +} + +Open Files:: + [/project-a/private.ts] + /project-a/tsconfig.json (default) + /project-c/tsconfig.json + [/project-b/public.ts] + /project-b/tsconfig.json (default) + /project-c/tsconfig.json + [/project-c/index.ts] *new* + /project-c/tsconfig.json (default) +Config:: + [/project-a/tsconfig.json] + RetainingProjects: + /project-a/tsconfig.json + /project-c/tsconfig.json + /tsconfig.json + RetainingOpenFiles: + /project-a/private.ts + [/project-b/tsconfig.json] + RetainingProjects: + /project-b/tsconfig.json + /project-c/tsconfig.json + /tsconfig.json + RetainingOpenFiles: + /project-b/public.ts + [/project-c/tsconfig.json] *modified* + RetainingProjects: + /project-c/tsconfig.json + /tsconfig.json + RetainingOpenFiles: *modified* + /project-c/index.ts *new* + [/tsconfig.base.json] + RetainingConfigs: + /project-a/tsconfig.json + /project-b/tsconfig.json + /project-c/tsconfig.json + /tsconfig.json + [/tsconfig.json] + RetainingProjects: + /tsconfig.json +Config File Names:: + [/project-a/private.ts] + NearestConfigFileName: /project-a/tsconfig.json + Ancestors: + /project-a/tsconfig.json /tsconfig.json + /tsconfig.json + [/project-b/public.ts] + NearestConfigFileName: /project-b/tsconfig.json + Ancestors: + /project-b/tsconfig.json /tsconfig.json + /tsconfig.json + [/project-c/index.ts] *new* + NearestConfigFileName: /project-c/tsconfig.json + Ancestors: + /project-c/tsconfig.json /tsconfig.json + /tsconfig.json + +{ + "method": "textDocument/references", + "params": { + "textDocument": { + "uri": "file:///project-c/index.ts" + }, + "position": { + "line": 1, + "character": 9 + }, + "context": { + "includeDeclaration": true + } + } +} + + + + +// === findAllReferences === +// === /project-c/index.ts === +// import { symbolB } from '../project-b/public'; +// import { /*FIND ALL REFS*/[|symbolA|] } from '../project-a/public'; +// console.log(symbolB); +// console.log([|symbolA|]); +// \ No newline at end of file From 06fd23818e2d0da532320b68bbd7b92f4a90688f Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Tue, 9 Dec 2025 09:11:17 -0800 Subject: [PATCH 2/3] Fix getReferencedSymbolsForSymbol, implement getReferencesAtExportSpecifier --- internal/fourslash/fourslash.go | 6 +- .../fourslash/tests/statefindallrefs_test.go | 2 - internal/ls/findallreferences.go | 109 +++++++++++++++--- .../documentHighlightInExport1.baseline.jsonc | 6 +- ...cumentHighlightInTypeExport.baseline.jsonc | 16 +-- ...HighlightsInvalidGlobalThis.baseline.jsonc | 2 +- ...cesNonExistentExportBinding.baseline.jsonc | 5 +- .../findAllRefsCommonJsRequire.baseline.jsonc | 2 +- ...fsForDefaultExport_reExport.baseline.jsonc | 30 ++++- .../findAllRefsOnImportAliases.baseline.jsonc | 11 +- ...findAllRefsOnImportAliases2.baseline.jsonc | 8 +- .../findAllRefsReExport_broken.baseline.jsonc | 4 +- ...findAllRefsReExport_broken2.baseline.jsonc | 4 +- ...erencesForStatementKeywords.baseline.jsonc | 18 ++- ...eImportAndExportInDiffFiles.baseline.jsonc | 6 +- .../renameImportOfExportEquals.baseline.jsonc | 14 ++- ...erencingFileFromReferencedProject.baseline | 14 ++- ...efsReExportInMultiProjectSolution.baseline | 17 +++ ...ReferencingDefaultProjectDirectly.baseline | 4 +- ...ferencingDefaultProjectIndirectly.baseline | 4 +- ...roughDisableReferencedProjectLoad.baseline | 4 +- ...ectLoadInOneButWithoutItInAnother.baseline | 4 +- ...ReferencingDefaultProjectDirectly.baseline | 4 +- ...findAllRefsOnImportAliases2.baseline.jsonc | 2 +- ...llRefsOnImportAliases2.baseline.jsonc.diff | 8 -- ...sForExportFromUnfoundModule.baseline.jsonc | 2 +- ...xportFromUnfoundModule.baseline.jsonc.diff | 9 -- .../renameExportSpecifier.baseline.jsonc | 6 +- .../renameExportSpecifier.baseline.jsonc.diff | 12 -- .../renameExportSpecifier2.baseline.jsonc | 8 +- ...renameExportSpecifier2.baseline.jsonc.diff | 15 +-- .../renameImportAndExport.baseline.jsonc | 6 +- .../renameImportAndExport.baseline.jsonc.diff | 17 --- ...eImportAndExportInDiffFiles.baseline.jsonc | 8 +- ...rtAndExportInDiffFiles.baseline.jsonc.diff | 25 ---- .../renameImportOfExportEquals.baseline.jsonc | 29 +++-- ...meImportOfExportEquals.baseline.jsonc.diff | 66 ----------- .../renameImportRequire.baseline.jsonc | 24 ++-- .../renameImportRequire.baseline.jsonc.diff | 60 ---------- .../renameReExportDefault.baseline.jsonc | 6 +- .../renameReExportDefault.baseline.jsonc.diff | 41 +++---- 41 files changed, 301 insertions(+), 337 deletions(-) delete mode 100644 testdata/baselines/reference/submodule/fourslash/findRenameLocations/findAllRefsOnImportAliases2.baseline.jsonc.diff delete mode 100644 testdata/baselines/reference/submodule/fourslash/findRenameLocations/highlightsForExportFromUnfoundModule.baseline.jsonc.diff delete mode 100644 testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier.baseline.jsonc.diff delete mode 100644 testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExport.baseline.jsonc.diff delete mode 100644 testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExportInDiffFiles.baseline.jsonc.diff delete mode 100644 testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportOfExportEquals.baseline.jsonc.diff delete mode 100644 testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportRequire.baseline.jsonc.diff diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index 43b388cc55..b43d3c98f9 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -616,8 +616,12 @@ func sendRequest[Params, Resp any](t *testing.T, f *FourslashTest, info lsproto. if resMsg == nil { t.Fatalf(prefix+"Nil response received for %s request", info.Method) } + resp := resMsg.AsResponse() + if resp.Error != nil { + t.Fatalf(prefix+"%s request returned error: %s", info.Method, resp.Error.String()) + } if !resultOk { - t.Fatalf(prefix+"Unexpected %s response type: %T", info.Method, resMsg.AsResponse().Result) + t.Fatalf(prefix+"Unexpected %s response type: %T", info.Method, resp.Result) } return result } diff --git a/internal/fourslash/tests/statefindallrefs_test.go b/internal/fourslash/tests/statefindallrefs_test.go index 9862f0e1a8..630bfc70ee 100644 --- a/internal/fourslash/tests/statefindallrefs_test.go +++ b/internal/fourslash/tests/statefindallrefs_test.go @@ -1044,8 +1044,6 @@ import * as shared from "../../shared/dist" func TestFindAllRefsReExportInMultiProjectSolution(t *testing.T) { t.Parallel() defer testutil.RecoverAndFail(t, "Panic on fourslash test") - // Repro from https://github.com/mjames-c/tsgo-playground - // Tests that find-all-references can follow re-exports across projects content := ` // @stateBaseline: true // @Filename: /tsconfig.base.json diff --git a/internal/ls/findallreferences.go b/internal/ls/findallreferences.go index d6758c69f2..f33309630a 100644 --- a/internal/ls/findallreferences.go +++ b/internal/ls/findallreferences.go @@ -1528,14 +1528,12 @@ func getReferencedSymbolsForSymbol(originalSymbol *ast.Symbol, node *ast.Node, s state := newState(sourceFiles, sourceFilesSet, node, checker /*, cancellationToken*/, searchMeaning, options) var exportSpecifier *ast.Node - if !isForRenameWithPrefixAndSuffixText(options) || len(symbol.Declarations) == 0 { + if isForRenameWithPrefixAndSuffixText(options) && len(symbol.Declarations) != 0 { exportSpecifier = core.Find(symbol.Declarations, ast.IsExportSpecifier) } if exportSpecifier != nil { - // !!! not implemented - // When renaming at an export specifier, rename the export and not the thing being exported. - // state.getReferencesAtExportSpecifier(exportSpecifier.Name(), symbol, exportSpecifier.AsExportSpecifier(), state.createSearch(node, originalSymbol, comingFromUnknown /*comingFrom*/, "", nil), true /*addReferencesHere*/, true /*alwaysGetReferences*/) + state.getReferencesAtExportSpecifier(exportSpecifier.Name(), symbol, exportSpecifier.AsExportSpecifier(), state.createSearch(node, originalSymbol, ImpExpKindUnknown /*comingFrom*/, "", nil), true /*addReferencesHere*/, true /*alwaysGetReferences*/) } else if node != nil && node.Kind == ast.KindDefaultKeyword && symbol.Name == ast.InternalSymbolNameDefault && symbol.Parent != nil { state.addReference(node, symbol, entryKindNode) state.searchForImportsOfExport(node, symbol, &ExportInfo{exportingModuleSymbol: symbol.Parent, exportKind: ExportKindDefault}) @@ -1583,22 +1581,21 @@ type refState struct { result []*SymbolAndEntries inheritsFromCache map[inheritKey]bool seenContainingTypeReferences collections.Set[*ast.Node] // node seen tracker - // seenReExportRHS *collections.Set[*ast.Node] // node seen tracker - importTracker ImportTracker - symbolToReferences map[*ast.Symbol]*SymbolAndEntries - sourceFileToSeenSymbols map[*ast.SourceFile]*collections.Set[*ast.Symbol] + seenReExportRHS collections.Set[*ast.Node] // node seen tracker + importTracker ImportTracker + symbolToReferences map[*ast.Symbol]*SymbolAndEntries + sourceFileToSeenSymbols map[*ast.SourceFile]*collections.Set[*ast.Symbol] } func newState(sourceFiles []*ast.SourceFile, sourceFilesSet *collections.Set[string], node *ast.Node, checker *checker.Checker, searchMeaning ast.SemanticMeaning, options refOptions) *refState { return &refState{ - sourceFiles: sourceFiles, - sourceFilesSet: sourceFilesSet, - specialSearchKind: getSpecialSearchKind(node), - checker: checker, - searchMeaning: searchMeaning, - options: options, - inheritsFromCache: map[inheritKey]bool{}, - // seenReExportRHS: &collections.Set[*ast.Node]{}, + sourceFiles: sourceFiles, + sourceFilesSet: sourceFilesSet, + specialSearchKind: getSpecialSearchKind(node), + checker: checker, + searchMeaning: searchMeaning, + options: options, + inheritsFromCache: map[inheritKey]bool{}, symbolToReferences: map[*ast.Symbol]*SymbolAndEntries{}, sourceFileToSeenSymbols: map[*ast.SourceFile]*collections.Set[*ast.Symbol]{}, } @@ -1911,9 +1908,7 @@ func (state *refState) getReferencesAtLocation(sourceFile *ast.SourceFile, posit } if parent.Kind == ast.KindExportSpecifier { - // !!! not implemented - // debug.Assert(referenceLocation.Kind == ast.KindIdentifier || referenceLocation.Kind == ast.KindStringLiteral) - // state.getReferencesAtExportSpecifier(referenceLocation /* Identifier | StringLiteral*/, referenceSymbol, parent.AsExportSpecifier(), search, addReferencesHere, false /*alwaysGetReferences*/) + state.getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent.AsExportSpecifier(), search, addReferencesHere, false /*alwaysGetReferences*/) return } @@ -2034,6 +2029,82 @@ func (state *refState) getImportOrExportReferences(referenceLocation *ast.Node, } } +func (state *refState) markSeenReExportRHS(node *ast.Node) bool { + return state.seenReExportRHS.AddIfAbsent(node) +} + +func (state *refState) getReferencesAtExportSpecifier( + referenceLocation *ast.Node, + referenceSymbol *ast.Symbol, + exportSpecifier *ast.ExportSpecifier, + search *refSearch, + addReferencesHere bool, + alwaysGetReferences bool, +) { + debug.Assert(!alwaysGetReferences || state.options.useAliasesForRename, "If alwaysGetReferences is true, then prefix/suffix text must be enabled") + + exportDeclaration := exportSpecifier.Parent.Parent.AsExportDeclaration() + propertyName := exportSpecifier.PropertyName + name := exportSpecifier.Name() + localSymbol := getLocalSymbolForExportSpecifier(referenceLocation.AsIdentifier(), referenceSymbol, exportSpecifier, state.checker) + + if !alwaysGetReferences && !search.includes(localSymbol) { + return + } + + addRef := func() { + if addReferencesHere { + state.addReference(referenceLocation, localSymbol, entryKindNode) + } + } + + if propertyName == nil { + // Don't rename at `export { default } from "m";`. (but do continue to search for imports of the re-export) + if !(state.options.use == referenceUseRename && ast.ModuleExportNameIsDefault(name)) { + addRef() + } + } else if referenceLocation == propertyName.AsNode() { + // For `export { foo as bar } from "baz"`, "`foo`" will be added from the singleReferences for import searches of the original export. + // For `export { foo as bar };`, where `foo` is a local, so add it now. + if exportDeclaration.ModuleSpecifier == nil { + addRef() + } + + if addReferencesHere && state.options.use != referenceUseRename && state.markSeenReExportRHS(name) { + exportSymbol := exportSpecifier.AsNode().Symbol() + debug.Assert(exportSymbol != nil, "exportSpecifier.Symbol() should not be nil") + state.addReference(name, exportSymbol, entryKindNode) + } + } else { + if state.markSeenReExportRHS(referenceLocation) { + addRef() + } + } + + // For `export { foo as bar }`, rename `foo`, but not `bar`. + if !isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences { + isDefaultExport := ast.ModuleExportNameIsDefault(referenceLocation) || ast.ModuleExportNameIsDefault(exportSpecifier.Name()) + exportKind := ExportKindNamed + if isDefaultExport { + exportKind = ExportKindDefault + } + exportSymbol := exportSpecifier.AsNode().Symbol() + debug.Assert(exportSymbol != nil, "exportSpecifier.Symbol() should not be nil") + exportInfo := getExportInfo(exportSymbol, exportKind, state.checker) + if exportInfo != nil { + state.searchForImportsOfExport(referenceLocation, exportSymbol, exportInfo) + } + } + + // At `export { x } from "foo"`, also search for the imported symbol `"foo".x`. + if search.comingFrom != ImpExpKindExport && exportDeclaration.ModuleSpecifier != nil && propertyName == nil && !isForRenameWithPrefixAndSuffixText(state.options) { + imported := state.checker.GetExportSpecifierLocalTargetSymbol(exportSpecifier.AsNode()) + if imported != nil { + state.searchForImportedSymbol(imported) + } + } +} + // Go to the symbol we imported from and find references for it. func (state *refState) searchForImportedSymbol(symbol *ast.Symbol) { for _, declaration := range symbol.Declarations { diff --git a/testdata/baselines/reference/fourslash/documentHighlights/documentHighlightInExport1.baseline.jsonc b/testdata/baselines/reference/fourslash/documentHighlights/documentHighlightInExport1.baseline.jsonc index 22a8f5e37a..d364e304db 100644 --- a/testdata/baselines/reference/fourslash/documentHighlights/documentHighlightInExport1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/documentHighlights/documentHighlightInExport1.baseline.jsonc @@ -1,7 +1,7 @@ // === documentHighlights === // === /documentHighlightInExport1.ts === // class /*HIGHLIGHTS*/[|C|] {} -// export { C as D }; +// export { [|C|] as [|D|] }; @@ -15,7 +15,7 @@ // === documentHighlights === // === /documentHighlightInExport1.ts === // class [|C|] {} -// export { /*HIGHLIGHTS*/C as D }; +// export { /*HIGHLIGHTS*/[|C|] as [|D|] }; @@ -29,4 +29,4 @@ // === documentHighlights === // === /documentHighlightInExport1.ts === // class C {} -// export { C as /*HIGHLIGHTS*/D }; \ No newline at end of file +// export { C as /*HIGHLIGHTS*/[|D|] }; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentHighlights/documentHighlightInTypeExport.baseline.jsonc b/testdata/baselines/reference/fourslash/documentHighlights/documentHighlightInTypeExport.baseline.jsonc index 2eaebb3867..e960fab796 100644 --- a/testdata/baselines/reference/fourslash/documentHighlights/documentHighlightInTypeExport.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/documentHighlights/documentHighlightInTypeExport.baseline.jsonc @@ -8,14 +8,14 @@ // === documentHighlights === // === /1.ts === // type A = 1; -// export { /*HIGHLIGHTS*/A as B }; +// export { /*HIGHLIGHTS*/[|A|] as [|B|] }; // === documentHighlights === // === /1.ts === // type A = 1; -// export { A as /*HIGHLIGHTS*/B }; +// export { A as /*HIGHLIGHTS*/[|B|] }; @@ -31,7 +31,7 @@ // === /2.ts === // type A = 1; // let /*HIGHLIGHTS*/[|A|]: A = 1; -// export { A as B }; +// export { [|A|] as [|B|] }; @@ -47,7 +47,7 @@ // === /2.ts === // type A = 1; // let [|A|]: A = 1; -// export { /*HIGHLIGHTS*/A as B }; +// export { /*HIGHLIGHTS*/[|A|] as [|B|] }; @@ -55,7 +55,7 @@ // === /2.ts === // type A = 1; // let A: A = 1; -// export { A as /*HIGHLIGHTS*/B }; +// export { A as /*HIGHLIGHTS*/[|B|] }; @@ -71,7 +71,7 @@ // === /3.ts === // type A = 1; // let /*HIGHLIGHTS*/[|A|]: A = 1; -// export type { A as B }; +// export type { [|A|] as [|B|] }; @@ -87,7 +87,7 @@ // === /3.ts === // type A = 1; // let [|A|]: A = 1; -// export type { /*HIGHLIGHTS*/A as B }; +// export type { /*HIGHLIGHTS*/[|A|] as [|B|] }; @@ -95,4 +95,4 @@ // === /3.ts === // type A = 1; // let A: A = 1; -// export type { A as /*HIGHLIGHTS*/B }; \ No newline at end of file +// export type { A as /*HIGHLIGHTS*/[|B|] }; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/documentHighlights/documentHighlightsInvalidGlobalThis.baseline.jsonc b/testdata/baselines/reference/fourslash/documentHighlights/documentHighlightsInvalidGlobalThis.baseline.jsonc index b4ca954745..1dcab80b3d 100644 --- a/testdata/baselines/reference/fourslash/documentHighlights/documentHighlightsInvalidGlobalThis.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/documentHighlights/documentHighlightsInvalidGlobalThis.baseline.jsonc @@ -1,5 +1,5 @@ // === documentHighlights === // === /documentHighlightsInvalidGlobalThis.ts === // declare global { -// export { globalThis as /*HIGHLIGHTS*/global } +// export { globalThis as /*HIGHLIGHTS*/[|global|] } // } \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesNonExistentExportBinding.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesNonExistentExportBinding.baseline.jsonc index e3ba1d5b6a..d6652ae187 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesNonExistentExportBinding.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesNonExistentExportBinding.baseline.jsonc @@ -1,3 +1,6 @@ // === findAllReferences === // === /bar.ts === -// import { [|Foo|]/*FIND ALL REFS*/ } from "./foo"; \ No newline at end of file +// import { [|Foo|]/*FIND ALL REFS*/ } from "./foo"; + +// === /foo.ts === +// export { [|Foo|] } \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsCommonJsRequire.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsCommonJsRequire.baseline.jsonc index 9cefb6e7a4..45a23cb382 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsCommonJsRequire.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsCommonJsRequire.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /a.js === // function [|f|]() { } -// export { f } +// export { [|f|] } // === /b.js === // const { [|f|] } = require('./a') diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport_reExport.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport_reExport.baseline.jsonc index c6e337ef4b..b7cf6af10e 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport_reExport.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport_reExport.baseline.jsonc @@ -3,6 +3,12 @@ // const /*FIND ALL REFS*/[|foo|] = 1; // export default [|foo|]; +// === /re-export-dep.ts === +// import [|fooDefault|] from "./re-export"; + +// === /re-export.ts === +// export { [|default|] } from "./export"; + // === findAllReferences === @@ -10,14 +16,34 @@ // const [|foo|] = 1; // export default /*FIND ALL REFS*/[|foo|]; +// === /re-export-dep.ts === +// import [|fooDefault|] from "./re-export"; + +// === /re-export.ts === +// export { [|default|] } from "./export"; + // === findAllReferences === +// === /export.ts === +// const [|foo|] = 1; +// export default [|foo|]; + +// === /re-export-dep.ts === +// import [|fooDefault|] from "./re-export"; + // === /re-export.ts === -// export { /*FIND ALL REFS*/default } from "./export"; +// export { /*FIND ALL REFS*/[|default|] } from "./export"; // === findAllReferences === +// === /export.ts === +// const [|foo|] = 1; +// export default [|foo|]; + // === /re-export-dep.ts === -// import /*FIND ALL REFS*/[|fooDefault|] from "./re-export"; \ No newline at end of file +// import /*FIND ALL REFS*/[|fooDefault|] from "./re-export"; + +// === /re-export.ts === +// export { [|default|] } from "./export"; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnImportAliases.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnImportAliases.baseline.jsonc index 0074e398ae..7d231f7fa6 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnImportAliases.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnImportAliases.baseline.jsonc @@ -8,6 +8,9 @@ // // var c = new [|Class|](); +// === /c.ts === +// export { [|Class|] } from "./a"; + // === findAllReferences === @@ -20,6 +23,9 @@ // // var c = new [|Class|](); +// === /c.ts === +// export { [|Class|] } from "./a"; + // === findAllReferences === @@ -30,4 +36,7 @@ // === /b.ts === // import { [|Class|] } from "./a"; // -// var c = new /*FIND ALL REFS*/[|Class|](); \ No newline at end of file +// var c = new /*FIND ALL REFS*/[|Class|](); + +// === /c.ts === +// export { [|Class|] } from "./a"; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnImportAliases2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnImportAliases2.baseline.jsonc index 78284dcace..530e3bec34 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnImportAliases2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnImportAliases2.baseline.jsonc @@ -7,7 +7,7 @@ // var c = new [|C2|](); // === /c.ts === -// export { [|Class|] as C3 } from "./a"; +// export { [|Class|] as [|C3|] } from "./a"; @@ -20,7 +20,7 @@ // var c = new [|C2|](); // === /c.ts === -// export { [|Class|] as C3 } from "./a"; +// export { [|Class|] as [|C3|] } from "./a"; @@ -33,7 +33,7 @@ // var c = new [|C2|](); // === /c.ts === -// export { /*FIND ALL REFS*/[|Class|] as C3 } from "./a"; +// export { /*FIND ALL REFS*/[|Class|] as [|C3|] } from "./a"; @@ -53,4 +53,4 @@ // === findAllReferences === // === /c.ts === -// export { Class as /*FIND ALL REFS*/C3 } from "./a"; \ No newline at end of file +// export { Class as /*FIND ALL REFS*/[|C3|] } from "./a"; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsReExport_broken.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsReExport_broken.baseline.jsonc index 68ba7882f2..31755efe5b 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsReExport_broken.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsReExport_broken.baseline.jsonc @@ -1,9 +1,9 @@ // === findAllReferences === // === /a.ts === -// /*FIND ALL REFS*/export { x }; +// /*FIND ALL REFS*/export { [|x|] }; // === findAllReferences === // === /a.ts === -// export { /*FIND ALL REFS*/x }; \ No newline at end of file +// export { /*FIND ALL REFS*/[|x|] }; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsReExport_broken2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsReExport_broken2.baseline.jsonc index 6dc48c5a33..c9420ecfbd 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsReExport_broken2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsReExport_broken2.baseline.jsonc @@ -1,9 +1,9 @@ // === findAllReferences === // === /a.ts === -// /*FIND ALL REFS*/export { x } from "nonsense"; +// /*FIND ALL REFS*/export { [|x|] } from "nonsense"; // === findAllReferences === // === /a.ts === -// export { /*FIND ALL REFS*/x } from "nonsense"; \ No newline at end of file +// export { /*FIND ALL REFS*/[|x|] } from "nonsense"; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForStatementKeywords.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForStatementKeywords.baseline.jsonc index bc4a02ea61..568a75dd72 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForStatementKeywords.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForStatementKeywords.baseline.jsonc @@ -354,12 +354,15 @@ // === findAllReferences === +// === /i.ts === +// export class [|I|] {} + // === /main.ts === // --- (line: 14) skipped --- // // export ... from ... // export type * from "./g"; // export type * as H from "./h"; -// /*FIND ALL REFS*/export type { I } from "./i"; +// /*FIND ALL REFS*/export type { [|I|] } from "./i"; // export type { j1, j2 as j3 } from "./j"; // type Z1 = 1; // export type { Z1 }; @@ -368,12 +371,15 @@ // === findAllReferences === +// === /i.ts === +// export class [|I|] {} + // === /main.ts === // --- (line: 14) skipped --- // // export ... from ... // export type * from "./g"; // export type * as H from "./h"; -// export /*FIND ALL REFS*/type { I } from "./i"; +// export /*FIND ALL REFS*/type { [|I|] } from "./i"; // export type { j1, j2 as j3 } from "./j"; // type Z1 = 1; // export type { Z1 }; @@ -446,7 +452,7 @@ // export type * from "./g"; // export type * as H from "./h"; // export type { I } from "./i"; -// export type { j1, j2 /*FIND ALL REFS*/as j3 } from "./j"; +// export type { j1, j2 /*FIND ALL REFS*/as [|j3|] } from "./j"; // type Z1 = 1; // export type { Z1 }; // type Z2 = 2; @@ -462,7 +468,7 @@ // export type { I } from "./i"; // export type { j1, j2 as j3 } from "./j"; // type [|Z1|] = 1; -// /*FIND ALL REFS*/export type { Z1 }; +// /*FIND ALL REFS*/export type { [|Z1|] }; // type Z2 = 2; // type Z3 = 3; // export type { z2, z3 as z4 }; @@ -476,7 +482,7 @@ // export type { I } from "./i"; // export type { j1, j2 as j3 } from "./j"; // type [|Z1|] = 1; -// export /*FIND ALL REFS*/type { Z1 }; +// export /*FIND ALL REFS*/type { [|Z1|] }; // type Z2 = 2; // type Z3 = 3; // export type { z2, z3 as z4 }; @@ -509,7 +515,7 @@ // export type { Z1 }; // type Z2 = 2; // type Z3 = 3; -// export type { z2, z3 /*FIND ALL REFS*/as z4 }; +// export type { z2, z3 /*FIND ALL REFS*/as [|z4|] }; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/renameImportAndExportInDiffFiles.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/renameImportAndExportInDiffFiles.baseline.jsonc index 8601eca2ac..985ec38318 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/renameImportAndExportInDiffFiles.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/renameImportAndExportInDiffFiles.baseline.jsonc @@ -4,7 +4,7 @@ // === /b.ts === // import { [|a|] } from './a'; -// export { a }; +// export { [|a|] }; @@ -14,7 +14,7 @@ // === /b.ts === // import { /*FIND ALL REFS*/[|a|] } from './a'; -// export { a }; +// export { [|a|] }; @@ -24,4 +24,4 @@ // === /b.ts === // import { [|a|] } from './a'; -// export { /*FIND ALL REFS*/a }; \ No newline at end of file +// export { /*FIND ALL REFS*/[|a|] }; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/renameImportOfExportEquals.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/renameImportOfExportEquals.baseline.jsonc index 683be0695a..febf7f8048 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/renameImportOfExportEquals.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/renameImportOfExportEquals.baseline.jsonc @@ -8,10 +8,12 @@ // } // declare module "a" { // import * as [|N|] from "mod"; -// export { N }; // Renaming N here would rename +// export { [|N|] }; // Renaming N here would rename // } // declare module "b" { -// --- (line: 12) skipped --- +// import { [|N|] } from "a"; +// export const y: typeof [|N|].x; +// } @@ -25,10 +27,12 @@ // } // declare module "a" { // import * as /*FIND ALL REFS*/[|N|] from "mod"; -// export { N }; // Renaming N here would rename +// export { [|N|] }; // Renaming N here would rename // } // declare module "b" { -// --- (line: 12) skipped --- +// import { [|N|] } from "a"; +// export const y: typeof [|N|].x; +// } @@ -42,7 +46,7 @@ // } // declare module "a" { // import * as [|N|] from "mod"; -// export { N }; // Renaming N here would rename +// export { [|N|] }; // Renaming N here would rename // } // declare module "b" { // import { /*FIND ALL REFS*/[|N|] } from "a"; diff --git a/testdata/baselines/reference/fourslash/state/findAllRefsProjectWithOwnFilesReferencingFileFromReferencedProject.baseline b/testdata/baselines/reference/fourslash/state/findAllRefsProjectWithOwnFilesReferencingFileFromReferencedProject.baseline index 22558923b8..95419fcd25 100644 --- a/testdata/baselines/reference/fourslash/state/findAllRefsProjectWithOwnFilesReferencingFileFromReferencedProject.baseline +++ b/testdata/baselines/reference/fourslash/state/findAllRefsProjectWithOwnFilesReferencingFileFromReferencedProject.baseline @@ -396,12 +396,17 @@ Config File Names:: // === findAllReferences === +// === /myproject/own/main.ts === +// import { [|foo|] } from '../target/src/main'; +// [|foo|](); +// export function bar() {} + // === /myproject/src/helpers/functions.ts === // export function [|foo|]() { return 1; } // === /myproject/src/main.ts === // import { [|foo|] } from './helpers/functions'; -// export { /*FIND ALL REFS*/foo }; +// export { /*FIND ALL REFS*/[|foo|] }; { "method": "textDocument/didClose", "params": { @@ -506,9 +511,14 @@ Config:: // export function bar() {} // +// === /myproject/own/main.ts === +// import { [|foo|] } from '../target/src/main'; +// [|foo|](); +// export function bar() {} + // === /myproject/src/helpers/functions.ts === // export function [|foo|]() { return 1; } // === /myproject/src/main.ts === // import { [|foo|] } from './helpers/functions'; -// export { foo }; \ No newline at end of file +// export { [|foo|] }; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/state/findAllRefsReExportInMultiProjectSolution.baseline b/testdata/baselines/reference/fourslash/state/findAllRefsReExportInMultiProjectSolution.baseline index 8a144e2abc..18c9fabc3a 100644 --- a/testdata/baselines/reference/fourslash/state/findAllRefsReExportInMultiProjectSolution.baseline +++ b/testdata/baselines/reference/fourslash/state/findAllRefsReExportInMultiProjectSolution.baseline @@ -154,6 +154,16 @@ Config:: // === /project-a/private.ts === // export const /*FIND ALL REFS*/[|symbolA|] = 'some-symbol'; // console.log([|symbolA|]); + +// === /project-a/public.ts === +// export { [|symbolA|] } from './private'; + +// === /project-c/index.ts === +// import { symbolB } from '../project-b/public'; +// import { [|symbolA|] } from '../project-a/public'; +// console.log(symbolB); +// console.log([|symbolA|]); +// { "method": "textDocument/didOpen", "params": { @@ -342,6 +352,13 @@ Config File Names:: // === findAllReferences === +// === /project-a/private.ts === +// export const [|symbolA|] = 'some-symbol'; +// console.log([|symbolA|]); + +// === /project-a/public.ts === +// export { [|symbolA|] } from './private'; + // === /project-c/index.ts === // import { symbolB } from '../project-b/public'; // import { /*FIND ALL REFS*/[|symbolA|] } from '../project-a/public'; diff --git a/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectDirectly.baseline b/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectDirectly.baseline index ba44b28478..0c4e7f0b4c 100644 --- a/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectDirectly.baseline +++ b/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectDirectly.baseline @@ -345,7 +345,7 @@ Config File Names:: // === /myproject/src/main.ts === // import { [|foo|] } from './helpers/functions'; -// export { /*FIND ALL REFS*/foo }; +// export { /*FIND ALL REFS*/[|foo|] }; { "method": "textDocument/didClose", "params": { @@ -444,4 +444,4 @@ Config:: // === /myproject/src/main.ts === // import { [|foo|] } from './helpers/functions'; -// export { foo }; \ No newline at end of file +// export { [|foo|] }; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectIndirectly.baseline b/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectIndirectly.baseline index 43a1190dc9..6b9f877b4e 100644 --- a/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectIndirectly.baseline +++ b/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectIndirectly.baseline @@ -518,7 +518,7 @@ Config File Names:: // === /myproject/src/main.ts === // import { [|foo|] } from './helpers/functions'; -// export { /*FIND ALL REFS*/foo }; +// export { /*FIND ALL REFS*/[|foo|] }; { "method": "textDocument/didClose", "params": { @@ -620,4 +620,4 @@ Config:: // === /myproject/src/main.ts === // import { [|foo|] } from './helpers/functions'; -// export { foo }; \ No newline at end of file +// export { [|foo|] }; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectIndirectlyThroughDisableReferencedProjectLoad.baseline b/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectIndirectlyThroughDisableReferencedProjectLoad.baseline index 3b8eae0e67..7e4db060dc 100644 --- a/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectIndirectlyThroughDisableReferencedProjectLoad.baseline +++ b/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectIndirectlyThroughDisableReferencedProjectLoad.baseline @@ -504,7 +504,7 @@ Config File Names:: // === /myproject/src/main.ts === // import { [|foo|] } from './helpers/functions'; -// export { /*FIND ALL REFS*/foo }; +// export { /*FIND ALL REFS*/[|foo|] }; { "method": "textDocument/didClose", "params": { @@ -594,4 +594,4 @@ Config:: // === /myproject/src/main.ts === // import { [|foo|] } from './helpers/functions'; -// export { foo }; \ No newline at end of file +// export { [|foo|] }; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectIndirectlyThroughDisableReferencedProjectLoadInOneButWithoutItInAnother.baseline b/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectIndirectlyThroughDisableReferencedProjectLoadInOneButWithoutItInAnother.baseline index 19287e15a1..1a77760def 100644 --- a/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectIndirectlyThroughDisableReferencedProjectLoadInOneButWithoutItInAnother.baseline +++ b/testdata/baselines/reference/fourslash/state/findAllRefsSolutionReferencingDefaultProjectIndirectlyThroughDisableReferencedProjectLoadInOneButWithoutItInAnother.baseline @@ -519,7 +519,7 @@ Config File Names:: // === /myproject/src/main.ts === // import { [|foo|] } from './helpers/functions'; -// export { /*FIND ALL REFS*/foo }; +// export { /*FIND ALL REFS*/[|foo|] }; { "method": "textDocument/didClose", "params": { @@ -621,4 +621,4 @@ Config:: // === /myproject/src/main.ts === // import { [|foo|] } from './helpers/functions'; -// export { foo }; \ No newline at end of file +// export { [|foo|] }; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/state/findAllRefsSolutionWithDisableReferencedProjectLoadReferencingDefaultProjectDirectly.baseline b/testdata/baselines/reference/fourslash/state/findAllRefsSolutionWithDisableReferencedProjectLoadReferencingDefaultProjectDirectly.baseline index 4900d5c940..6cea2295d9 100644 --- a/testdata/baselines/reference/fourslash/state/findAllRefsSolutionWithDisableReferencedProjectLoadReferencingDefaultProjectDirectly.baseline +++ b/testdata/baselines/reference/fourslash/state/findAllRefsSolutionWithDisableReferencedProjectLoadReferencingDefaultProjectDirectly.baseline @@ -332,7 +332,7 @@ Config File Names:: // === /myproject/src/main.ts === // import { [|foo|] } from './helpers/functions'; -// export { /*FIND ALL REFS*/foo }; +// export { /*FIND ALL REFS*/[|foo|] }; { "method": "textDocument/didClose", "params": { @@ -419,4 +419,4 @@ Config:: // === /myproject/src/main.ts === // import { [|foo|] } from './helpers/functions'; -// export { foo }; \ No newline at end of file +// export { [|foo|] }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/findAllRefsOnImportAliases2.baseline.jsonc b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/findAllRefsOnImportAliases2.baseline.jsonc index ef489e4c5e..4ae482a6f6 100644 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/findAllRefsOnImportAliases2.baseline.jsonc +++ b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/findAllRefsOnImportAliases2.baseline.jsonc @@ -53,4 +53,4 @@ // === findRenameLocations === // === /c.ts === -// export { Class as /*RENAME*/C3 } from "./a"; \ No newline at end of file +// export { Class as /*RENAME*/[|C3RENAME|] } from "./a"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/findAllRefsOnImportAliases2.baseline.jsonc.diff b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/findAllRefsOnImportAliases2.baseline.jsonc.diff deleted file mode 100644 index 293d6126e0..0000000000 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/findAllRefsOnImportAliases2.baseline.jsonc.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.findAllRefsOnImportAliases2.baseline.jsonc -+++ new.findAllRefsOnImportAliases2.baseline.jsonc -@@= skipped -52, +52 lines =@@ - - // === findRenameLocations === - // === /c.ts === --// export { Class as /*RENAME*/[|C3RENAME|] } from "./a"; -+// export { Class as /*RENAME*/C3 } from "./a"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/highlightsForExportFromUnfoundModule.baseline.jsonc b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/highlightsForExportFromUnfoundModule.baseline.jsonc index 327559c1b5..4e1a5100bb 100644 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/highlightsForExportFromUnfoundModule.baseline.jsonc +++ b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/highlightsForExportFromUnfoundModule.baseline.jsonc @@ -1,5 +1,5 @@ // === findRenameLocations === // === /b.js === // export { -// /*RENAME*/foo +// /*START PREFIX*/foo as /*RENAME*/[|fooRENAME|] // } from './a'; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/highlightsForExportFromUnfoundModule.baseline.jsonc.diff b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/highlightsForExportFromUnfoundModule.baseline.jsonc.diff deleted file mode 100644 index 585d82efd7..0000000000 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/highlightsForExportFromUnfoundModule.baseline.jsonc.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.highlightsForExportFromUnfoundModule.baseline.jsonc -+++ new.highlightsForExportFromUnfoundModule.baseline.jsonc -@@= skipped -0, +0 lines =@@ - // === findRenameLocations === - // === /b.js === - // export { --// /*START PREFIX*/foo as /*RENAME*/[|fooRENAME|] -+// /*RENAME*/foo - // } from './a'; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier.baseline.jsonc b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier.baseline.jsonc index 6e30fd32c4..476fd6c7f4 100644 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier.baseline.jsonc +++ b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier.baseline.jsonc @@ -3,4 +3,8 @@ // === /a.ts === // const name = {}; -// export { name as name/*RENAME*/ }; \ No newline at end of file +// export { name as [|nameRENAME|]/*RENAME*/ }; + +// === /b.ts === +// import { [|nameRENAME|] } from './a'; +// const x = [|nameRENAME|].toString(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier.baseline.jsonc.diff b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier.baseline.jsonc.diff deleted file mode 100644 index 6c108ca3a9..0000000000 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier.baseline.jsonc.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.renameExportSpecifier.baseline.jsonc -+++ new.renameExportSpecifier.baseline.jsonc -@@= skipped -2, +2 lines =@@ - - // === /a.ts === - // const name = {}; --// export { name as [|nameRENAME|]/*RENAME*/ }; -- --// === /b.ts === --// import { [|nameRENAME|] } from './a'; --// const x = [|nameRENAME|].toString(); -+// export { name as name/*RENAME*/ }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier2.baseline.jsonc b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier2.baseline.jsonc index 155c542abf..0b1ead83bf 100644 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier2.baseline.jsonc +++ b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier2.baseline.jsonc @@ -2,5 +2,9 @@ // @useAliasesForRename: false // === /a.ts === -// const [|nameRENAME|] = {}; -// export { name/*RENAME*/ }; \ No newline at end of file +// const name = {}; +// export { /*START PREFIX*/name as [|nameRENAME|]/*RENAME*/ }; + +// === /b.ts === +// import { [|nameRENAME|] } from './a'; +// const x = [|nameRENAME|].toString(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier2.baseline.jsonc.diff b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier2.baseline.jsonc.diff index 2fd41bf05f..b17ced5c57 100644 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier2.baseline.jsonc.diff +++ b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameExportSpecifier2.baseline.jsonc.diff @@ -1,12 +1,13 @@ --- old.renameExportSpecifier2.baseline.jsonc +++ new.renameExportSpecifier2.baseline.jsonc -@@= skipped -2, +2 lines =@@ +@@= skipped -1, +1 lines =@@ + // @useAliasesForRename: false // === /a.ts === - // const [|nameRENAME|] = {}; +-// const [|nameRENAME|] = {}; -// export { [|nameRENAME|]/*RENAME*/ }; -- --// === /b.ts === --// import { [|nameRENAME|] } from './a'; --// const x = [|nameRENAME|].toString(); -+// export { name/*RENAME*/ }; \ No newline at end of file ++// const name = {}; ++// export { /*START PREFIX*/name as [|nameRENAME|]/*RENAME*/ }; + + // === /b.ts === + // import { [|nameRENAME|] } from './a'; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExport.baseline.jsonc b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExport.baseline.jsonc index f2c7a402dd..91e94808d3 100644 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExport.baseline.jsonc +++ b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExport.baseline.jsonc @@ -1,11 +1,11 @@ // === findRenameLocations === // === /renameImportAndExport.ts === // import /*RENAME*/[|aRENAME|] from "module"; -// export { a }; +// export { [|aRENAME|] as a/*END SUFFIX*/ }; // === findRenameLocations === // === /renameImportAndExport.ts === -// import [|aRENAME|] from "module"; -// export { /*RENAME*/a }; \ No newline at end of file +// import a from "module"; +// export { /*START PREFIX*/a as /*RENAME*/[|aRENAME|] }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExport.baseline.jsonc.diff b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExport.baseline.jsonc.diff deleted file mode 100644 index 7579be5fcf..0000000000 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExport.baseline.jsonc.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.renameImportAndExport.baseline.jsonc -+++ new.renameImportAndExport.baseline.jsonc -@@= skipped -0, +0 lines =@@ - // === findRenameLocations === - // === /renameImportAndExport.ts === - // import /*RENAME*/[|aRENAME|] from "module"; --// export { [|aRENAME|] as a/*END SUFFIX*/ }; -+// export { a }; - - - - // === findRenameLocations === - // === /renameImportAndExport.ts === --// import a from "module"; --// export { /*START PREFIX*/a as /*RENAME*/[|aRENAME|] }; -+// import [|aRENAME|] from "module"; -+// export { /*RENAME*/a }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExportInDiffFiles.baseline.jsonc b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExportInDiffFiles.baseline.jsonc index 3df1b40965..9954568db2 100644 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExportInDiffFiles.baseline.jsonc +++ b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExportInDiffFiles.baseline.jsonc @@ -4,18 +4,18 @@ // === /b.ts === // import { [|aRENAME|] } from './a'; -// export { a }; +// export { [|aRENAME|] as a/*END SUFFIX*/ }; // === findRenameLocations === // === /b.ts === // import { /*START PREFIX*/a as /*RENAME*/[|aRENAME|] } from './a'; -// export { a }; +// export { [|aRENAME|] as a/*END SUFFIX*/ }; // === findRenameLocations === // === /b.ts === -// import { /*START PREFIX*/a as [|aRENAME|] } from './a'; -// export { /*RENAME*/a }; \ No newline at end of file +// import { a } from './a'; +// export { /*START PREFIX*/a as /*RENAME*/[|aRENAME|] }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExportInDiffFiles.baseline.jsonc.diff b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExportInDiffFiles.baseline.jsonc.diff deleted file mode 100644 index bbe6b24e4e..0000000000 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportAndExportInDiffFiles.baseline.jsonc.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.renameImportAndExportInDiffFiles.baseline.jsonc -+++ new.renameImportAndExportInDiffFiles.baseline.jsonc -@@= skipped -3, +3 lines =@@ - - // === /b.ts === - // import { [|aRENAME|] } from './a'; --// export { [|aRENAME|] as a/*END SUFFIX*/ }; -+// export { a }; - - - - // === findRenameLocations === - // === /b.ts === - // import { /*START PREFIX*/a as /*RENAME*/[|aRENAME|] } from './a'; --// export { [|aRENAME|] as a/*END SUFFIX*/ }; -+// export { a }; - - - - // === findRenameLocations === - // === /b.ts === --// import { a } from './a'; --// export { /*START PREFIX*/a as /*RENAME*/[|aRENAME|] }; -+// import { /*START PREFIX*/a as [|aRENAME|] } from './a'; -+// export { /*RENAME*/a }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportOfExportEquals.baseline.jsonc b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportOfExportEquals.baseline.jsonc index 82f4dab030..0d04ef0192 100644 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportOfExportEquals.baseline.jsonc +++ b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportOfExportEquals.baseline.jsonc @@ -8,10 +8,12 @@ // } // declare module "a" { // import * as [|NRENAME|] from "mod"; -// export { N }; // Renaming N here would rename +// export { [|NRENAME|] as N/*END SUFFIX*/ }; // Renaming N here would rename // } // declare module "b" { -// --- (line: 12) skipped --- +// import { N } from "a"; +// export const y: typeof N.x; +// } @@ -25,10 +27,12 @@ // } // declare module "a" { // import * as [|NRENAME|] from "mod"; -// export { N }; // Renaming N here would rename +// export { [|NRENAME|] as N/*END SUFFIX*/ }; // Renaming N here would rename // } // declare module "b" { -// --- (line: 12) skipped --- +// import { N } from "a"; +// export const y: typeof N.x; +// } @@ -39,25 +43,26 @@ // } // declare module "a" { // import * as /*RENAME*/[|NRENAME|] from "mod"; -// export { N }; // Renaming N here would rename +// export { [|NRENAME|] as N/*END SUFFIX*/ }; // Renaming N here would rename // } // declare module "b" { -// --- (line: 12) skipped --- +// import { N } from "a"; +// export const y: typeof N.x; +// } // === findRenameLocations === // === /renameImportOfExportEquals.ts === -// --- (line: 4) skipped --- -// export = N; +// --- (line: 5) skipped --- // } // declare module "a" { -// import * as [|NRENAME|] from "mod"; -// export { /*RENAME*/N }; // Renaming N here would rename +// import * as N from "mod"; +// export { /*START PREFIX*/N as /*RENAME*/[|NRENAME|] }; // Renaming N here would rename // } // declare module "b" { -// import { N } from "a"; -// export const y: typeof N.x; +// import { [|NRENAME|] } from "a"; +// export const y: typeof [|NRENAME|].x; // } diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportOfExportEquals.baseline.jsonc.diff b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportOfExportEquals.baseline.jsonc.diff deleted file mode 100644 index 59c986c82b..0000000000 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportOfExportEquals.baseline.jsonc.diff +++ /dev/null @@ -1,66 +0,0 @@ ---- old.renameImportOfExportEquals.baseline.jsonc -+++ new.renameImportOfExportEquals.baseline.jsonc -@@= skipped -7, +7 lines =@@ - // } - // declare module "a" { - // import * as [|NRENAME|] from "mod"; --// export { [|NRENAME|] as N/*END SUFFIX*/ }; // Renaming N here would rename -+// export { N }; // Renaming N here would rename - // } - // declare module "b" { --// import { N } from "a"; --// export const y: typeof N.x; --// } -+// --- (line: 12) skipped --- - - - -@@= skipped -19, +17 lines =@@ - // } - // declare module "a" { - // import * as [|NRENAME|] from "mod"; --// export { [|NRENAME|] as N/*END SUFFIX*/ }; // Renaming N here would rename -+// export { N }; // Renaming N here would rename - // } - // declare module "b" { --// import { N } from "a"; --// export const y: typeof N.x; --// } -+// --- (line: 12) skipped --- - - - -@@= skipped -16, +14 lines =@@ - // } - // declare module "a" { - // import * as /*RENAME*/[|NRENAME|] from "mod"; --// export { [|NRENAME|] as N/*END SUFFIX*/ }; // Renaming N here would rename -+// export { N }; // Renaming N here would rename - // } - // declare module "b" { --// import { N } from "a"; --// export const y: typeof N.x; --// } -+// --- (line: 12) skipped --- - - - - // === findRenameLocations === - // === /renameImportOfExportEquals.ts === --// --- (line: 5) skipped --- -+// --- (line: 4) skipped --- -+// export = N; - // } - // declare module "a" { --// import * as N from "mod"; --// export { /*START PREFIX*/N as /*RENAME*/[|NRENAME|] }; // Renaming N here would rename -+// import * as [|NRENAME|] from "mod"; -+// export { /*RENAME*/N }; // Renaming N here would rename - // } - // declare module "b" { --// import { [|NRENAME|] } from "a"; --// export const y: typeof [|NRENAME|].x; -+// import { N } from "a"; -+// export const y: typeof N.x; - // } - diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportRequire.baseline.jsonc b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportRequire.baseline.jsonc index 9a6afde3d1..888e82a57b 100644 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportRequire.baseline.jsonc +++ b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportRequire.baseline.jsonc @@ -3,7 +3,7 @@ // import /*RENAME*/[|eRENAME|] = require("mod4"); // [|eRENAME|]; // a = { /*START PREFIX*/e: [|eRENAME|] }; -// export { e }; +// export { [|eRENAME|] as e/*END SUFFIX*/ }; @@ -12,7 +12,7 @@ // import [|eRENAME|] = require("mod4"); // /*RENAME*/[|eRENAME|]; // a = { /*START PREFIX*/e: [|eRENAME|] }; -// export { e }; +// export { [|eRENAME|] as e/*END SUFFIX*/ }; @@ -21,27 +21,31 @@ // import [|eRENAME|] = require("mod4"); // [|eRENAME|]; // a = { /*START PREFIX*/e: /*RENAME*/[|eRENAME|] }; -// export { e }; +// export { [|eRENAME|] as e/*END SUFFIX*/ }; // === findRenameLocations === // === /a.ts === -// import [|eRENAME|] = require("mod4"); -// [|eRENAME|]; -// a = { /*START PREFIX*/e: [|eRENAME|] }; -// export { /*RENAME*/e }; +// import e = require("mod4"); +// e; +// a = { e }; +// export { /*START PREFIX*/e as /*RENAME*/[|eRENAME|] }; + +// === /b.ts === +// import { [|eRENAME|] } from "./a"; +// export { [|eRENAME|] as e/*END SUFFIX*/ }; // === findRenameLocations === // === /b.ts === // import { /*START PREFIX*/e as /*RENAME*/[|eRENAME|] } from "./a"; -// export { e }; +// export { [|eRENAME|] as e/*END SUFFIX*/ }; // === findRenameLocations === // === /b.ts === -// import { /*START PREFIX*/e as [|eRENAME|] } from "./a"; -// export { /*RENAME*/e }; \ No newline at end of file +// import { e } from "./a"; +// export { /*START PREFIX*/e as /*RENAME*/[|eRENAME|] }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportRequire.baseline.jsonc.diff b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportRequire.baseline.jsonc.diff deleted file mode 100644 index f7fe0c1be4..0000000000 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameImportRequire.baseline.jsonc.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.renameImportRequire.baseline.jsonc -+++ new.renameImportRequire.baseline.jsonc -@@= skipped -2, +2 lines =@@ - // import /*RENAME*/[|eRENAME|] = require("mod4"); - // [|eRENAME|]; - // a = { /*START PREFIX*/e: [|eRENAME|] }; --// export { [|eRENAME|] as e/*END SUFFIX*/ }; -+// export { e }; - - - -@@= skipped -9, +9 lines =@@ - // import [|eRENAME|] = require("mod4"); - // /*RENAME*/[|eRENAME|]; - // a = { /*START PREFIX*/e: [|eRENAME|] }; --// export { [|eRENAME|] as e/*END SUFFIX*/ }; -+// export { e }; - - - -@@= skipped -9, +9 lines =@@ - // import [|eRENAME|] = require("mod4"); - // [|eRENAME|]; - // a = { /*START PREFIX*/e: /*RENAME*/[|eRENAME|] }; --// export { [|eRENAME|] as e/*END SUFFIX*/ }; -+// export { e }; - - - - // === findRenameLocations === - // === /a.ts === --// import e = require("mod4"); --// e; --// a = { e }; --// export { /*START PREFIX*/e as /*RENAME*/[|eRENAME|] }; -- --// === /b.ts === --// import { [|eRENAME|] } from "./a"; --// export { [|eRENAME|] as e/*END SUFFIX*/ }; -+// import [|eRENAME|] = require("mod4"); -+// [|eRENAME|]; -+// a = { /*START PREFIX*/e: [|eRENAME|] }; -+// export { /*RENAME*/e }; - - - - // === findRenameLocations === - // === /b.ts === - // import { /*START PREFIX*/e as /*RENAME*/[|eRENAME|] } from "./a"; --// export { [|eRENAME|] as e/*END SUFFIX*/ }; -+// export { e }; - - - - // === findRenameLocations === - // === /b.ts === --// import { e } from "./a"; --// export { /*START PREFIX*/e as /*RENAME*/[|eRENAME|] }; -+// import { /*START PREFIX*/e as [|eRENAME|] } from "./a"; -+// export { /*RENAME*/e }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameReExportDefault.baseline.jsonc b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameReExportDefault.baseline.jsonc index 450c8648bd..a1f66fb89a 100644 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameReExportDefault.baseline.jsonc +++ b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameReExportDefault.baseline.jsonc @@ -1,7 +1,7 @@ // === findRenameLocations === // === /a.ts === // export { default } from "./b"; -// export { default as /*RENAME*/b } from "./b"; +// export { default as /*RENAME*/[|bRENAME|] } from "./b"; // export { default as bee } from "./b"; // import { default as b } from "./b"; // import { default as bee } from "./b"; @@ -34,7 +34,7 @@ // === findRenameLocations === // === /a.ts === // export { default } from "./b"; -// export { default as b } from "./b"; +// export { default as [|bRENAME|] } from "./b"; // export { default as bee } from "./b"; // import { default as [|bRENAME|] } from "./b"; // import { default as bee } from "./b"; @@ -49,7 +49,7 @@ // === findRenameLocations === // === /a.ts === // export { default } from "./b"; -// export { default as b } from "./b"; +// export { default as [|bRENAME|] } from "./b"; // export { default as bee } from "./b"; // import { default as [|bRENAME|] } from "./b"; // import { default as bee } from "./b"; diff --git a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameReExportDefault.baseline.jsonc.diff b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameReExportDefault.baseline.jsonc.diff index 37732e586e..891f145f75 100644 --- a/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameReExportDefault.baseline.jsonc.diff +++ b/testdata/baselines/reference/submodule/fourslash/findRenameLocations/renameReExportDefault.baseline.jsonc.diff @@ -1,21 +1,12 @@ --- old.renameReExportDefault.baseline.jsonc +++ new.renameReExportDefault.baseline.jsonc -@@= skipped -0, +0 lines =@@ - // === findRenameLocations === - // === /a.ts === - // export { default } from "./b"; --// export { default as /*RENAME*/[|bRENAME|] } from "./b"; -+// export { default as /*RENAME*/b } from "./b"; - // export { default as bee } from "./b"; - // import { default as b } from "./b"; - // import { default as bee } from "./b"; @@= skipped -31, +31 lines =@@ // === findRenameLocations === +// === /a.ts === +// export { default } from "./b"; -+// export { default as b } from "./b"; ++// export { default as [|bRENAME|] } from "./b"; +// export { default as bee } from "./b"; +// import { default as [|bRENAME|] } from "./b"; +// import { default as bee } from "./b"; @@ -25,21 +16,25 @@ // const /*RENAME*/[|bRENAME|] = 0; // export default [|bRENAME|]; -+ -+ -+// === findRenameLocations === - // === /a.ts === - // export { default } from "./b"; +-// === /a.ts === +-// export { default } from "./b"; -// export { default as [|bRENAME|] } from "./b"; -+// export { default as b } from "./b"; - // export { default as bee } from "./b"; - // import { default as [|bRENAME|] } from "./b"; - // import { default as bee } from "./b"; - // import [|bRENAME|] from "./b"; - -- +-// export { default as bee } from "./b"; +-// import { default as [|bRENAME|] } from "./b"; +-// import { default as bee } from "./b"; +-// import [|bRENAME|] from "./b"; - --// === findRenameLocations === + + + // === findRenameLocations === ++// === /a.ts === ++// export { default } from "./b"; ++// export { default as [|bRENAME|] } from "./b"; ++// export { default as bee } from "./b"; ++// import { default as [|bRENAME|] } from "./b"; ++// import { default as bee } from "./b"; ++// import [|bRENAME|] from "./b"; ++ // === /b.ts === // const [|bRENAME|] = 0; // export default /*RENAME*/[|bRENAME|]; From 671fb6d44e769dc5cb6a97b039a9ccb1cc17c197 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Tue, 9 Dec 2025 09:15:08 -0800 Subject: [PATCH 3/3] Newly passing test --- internal/fourslash/_scripts/failingTests.txt | 1 - internal/fourslash/tests/gen/renameForAliasingExport02_test.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/fourslash/_scripts/failingTests.txt b/internal/fourslash/_scripts/failingTests.txt index c39adccf8b..f0c6da0780 100644 --- a/internal/fourslash/_scripts/failingTests.txt +++ b/internal/fourslash/_scripts/failingTests.txt @@ -539,7 +539,6 @@ TestQuickinfoWrongComment TestRecursiveInternalModuleImport TestReferencesInEmptyFile TestRegexDetection -TestRenameForAliasingExport02 TestRenameFromNodeModulesDep1 TestRenameFromNodeModulesDep2 TestRenameFromNodeModulesDep3 diff --git a/internal/fourslash/tests/gen/renameForAliasingExport02_test.go b/internal/fourslash/tests/gen/renameForAliasingExport02_test.go index cd63097da0..f146cf2b95 100644 --- a/internal/fourslash/tests/gen/renameForAliasingExport02_test.go +++ b/internal/fourslash/tests/gen/renameForAliasingExport02_test.go @@ -9,7 +9,7 @@ import ( func TestRenameForAliasingExport02(t *testing.T) { t.Parallel() - t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `// @Filename: foo.ts let x = 1;