microsoft / microsoft/TypeScript

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

Offen
#60,763 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

🔍 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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, die references-Anfrage von tsserver nachzuverfolgen und ihre Argumente mit NavtoRequestArgs zu vergleichen, das im Issue als Präzedenzfall angeführt wird. Ermittle die betroffenen Anfrage- und Antwortpfade und füge anschließend eine Option hinzu und validiere sie, mit der Referenzen auf die angegebene Datei beschränkt werden können, ohne das bestehende Verhalten zu ändern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
tooling
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.