Skip to content

Fixes searches for symbols exported using export * as #39507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2020
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
4 changes: 4 additions & 0 deletions src/services/importTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ namespace ts.FindAllReferences {
// This is `export * from "foo"`, so imports of this module may import the export too.
handleDirectImports(getContainingModuleSymbol(direct, checker));
}
else if (direct.exportClause.kind === SyntaxKind.NamespaceExport) {
// `export * as foo from "foo"` add to indirect uses
addIndirectUsers(getSourceFileLikeForImportDeclaration(direct));
}
else {
// This is `export { foo } from "foo"` and creates an alias symbol, so recursive search will get handle re-exports.
directImports.push(direct);
Expand Down
16 changes: 16 additions & 0 deletions tests/cases/fourslash/findAllRefsReExportStarAs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference path="fourslash.ts" />

// @Filename: /leafModule.ts
////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}hello|] = () => 'Hello';|]

// @Filename: /exporting.ts
////export * as Leaf from './leafModule';

// @Filename: /importing.ts
//// import { Leaf } from './exporting';
//// Leaf.[|hello|]()

verify.noErrors();
const ranges = test.ranges();
const [r0Def, r0, r1] = ranges;
verify.singleReferenceGroup("const hello: () => string", [r0, r1]);