Skip to content
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

[tsserver] add support to fetch symbol references from only the current file. #60763

Open
6 tasks done
AraCoders opened this issue Dec 14, 2024 · 1 comment
Open
6 tasks done
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript

Comments

@AraCoders
Copy link

AraCoders commented Dec 14, 2024

πŸ” Search Terms

Hey.
it will be awesome if the "references" command can only get references of a symbol at position (x,y) but only inside the current file.

βœ… Viability Checklist

⭐ Suggestion

this can be added using currentFileOnly?: boolean; (like that inside interface NavtoRequestArgs).

πŸ“ƒ Motivating Example

i use it mainly for rewriting javascript files (usually obfuscated ones), so for each symbol i need to get all references but only for the currently opened file, so i wish there was a flag for it. as i thought it will be more performant (i.e. instead of searching references all across the project, if we restricted it to the current file - by a flag in a the request - then it can be more performant due to reduced search space?)

πŸ’» Use Cases

  1. What do you want to use this for?
  • rewriting js files accurately.
  1. What shortcomings exist with current approaches?
  • performance issues.
  1. What workarounds are you using in the meantime?
  • requesting references then filtering them if the ref['file'] key is the same as that supplied in references request. however, i think tsserver can be more performant than this approach.
@RyanCavanaugh
Copy link
Member

The "document highlights" API may be what you want

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants