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

Consistently order and differentiate navto results #49103

Open
amcasey opened this issue May 13, 2022 · 1 comment
Open

Consistently order and differentiate navto results #49103

amcasey opened this issue May 13, 2022 · 1 comment
Labels
Domain: Symbol Navigation Relates to go-to-definition, find-all-references, highlighting/occurrences. In Discussion Not yet reached consensus Suggestion An idea for TypeScript

Comments

@amcasey
Copy link
Member

amcasey commented May 13, 2022

In some circumstances, it is possible to have both an input and output file present in open projects at the same time. The motivating example was in VS when a TS file is open in one editor tab and a cshtml file consuming the corresponding JS file via <script src= is open in another (VS rewrites the <script src= to a triple-slash reference before sending the text to the server). In this scenario, the TS file is open in a configured project and the JS file is closed, but present, in an inferred project. (This particular scenario does not affect VS Code, which does not rewrite <script src=, but you can just open both files.)

When navigate-to (protocol request navto[-full]), aka go-to-symbol, is invoked, it shows declarations from both the TS and the JS files. While it's possible they could be de-dup'd through some amount of source-mapping or other relationship tracking, that is likely to be prohibitively expensive for the number of entries involved in a typical navto response.

Instead, we should just ensure that the elements are returned in a predictable order (e.g. always prefer TS) and, ideally, provide enough information to differentiate them (presently, they both get the same icon, indicating only the type of symbol).

image

@andrewbranch andrewbranch added Suggestion An idea for TypeScript In Discussion Not yet reached consensus Domain: Symbol Navigation Relates to go-to-definition, find-all-references, highlighting/occurrences. labels May 24, 2022
@andrewbranch
Copy link
Member

Relevant points also mentioned in the discussion:

  • Fuzzy search might mess with the order as you type? (Hopefully not if both items have identical text)
  • Might we migrate to letting AnyCode handle NavTo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Symbol Navigation Relates to go-to-definition, find-all-references, highlighting/occurrences. In Discussion Not yet reached consensus Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants