Skip to content

Missing references by tsserver when using export * as #39006

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

Closed
jomi-se opened this issue Jun 10, 2020 · 3 comments · Fixed by #39507 or #39533
Closed

Missing references by tsserver when using export * as #39006

jomi-se opened this issue Jun 10, 2020 · 3 comments · Fixed by #39507 or #39533
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@jomi-se
Copy link

jomi-se commented Jun 10, 2020

TypeScript Version: Tried with 3.8.0, 3.9.5 and next

Search Terms:
references
export * as
tsserver

Code
Reproduction branch https://github.com/jomi-se/ts-scripting-env/tree/ts-references-export-as/src

Try to get the references (using VSCode or another editor that uses tsserver) for the hello function in leafModule.ts. It's usage in importing.ts is not listed on the result.

Tl;dr

// importing.ts
import { Leaf } from './exporting';

Leaf.hello()

// exporting.ts
export * as Leaf from './leafModule'

// leafModule.ts
// Try to get the references of `hello` declared here
export const hello = () => console.log('Hello')

Expected behavior:
The usage of hello in importing.ts (in Leaf.hello()) should be listed in its references

Actual behavior:
The usage of hello in importing.ts (in Leaf.hello()) is not listed. However, using go to definition from this usage does work correctly.

Related Issues:
Found this #33017 but it didn't mention export * as ... cases

@jomi-se
Copy link
Author

jomi-se commented Jun 16, 2020

Bump on this. This makes it really annoying to use the export * as ... feature on large codebases as you have to do textual search to find references now.

@jomi-se
Copy link
Author

jomi-se commented Jul 8, 2020

Thank you for your work @sheetalkamat !

@jomi-se
Copy link
Author

jomi-se commented Jul 9, 2020

Hello @sheetalkamat 👋
Confirming this fixes getting the references for the function hello in the example.

However, if I try to get the references for Leaf in the exporting.ts file, I only get its declaration

sheetalkamat added a commit that referenced this issue Jul 9, 2020
sheetalkamat added a commit that referenced this issue Jul 9, 2020
* Fixes searches for export * as 'identifier'
Fixes #39006

* Fix the context span to export declaration (was incorrectly set to sourceFile in prev commit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
3 participants