Skip to content

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

Open
@AraCoders

Description

πŸ” 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.

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions