"Go to symbol in editor" in Code does not work if built-in TS disabled
The editor command workbench.action.gotoSymbol, also trigger-able as "Go to symbol in editor", does not work when the built-in TS support is disabled. This appears to be something like an unimplement LSP method, perhaps?
This appears to be something like an unimplement LSP method, perhaps?
Confirmed! We have a handler for onWorkspaceSymbol but not onDocumentSymbol here.
I would guess the trickiest part of fixing this may just be figuring out what the corresponding method on ts.LanguageService is, since their nomenclature is often wildly different from the general protocol (e.g. a WorkspaceSymbol request corresponds to the getNavigateToItems() method on the service itself 😅).
Beyond that, it should be straightforward to implement following the pattern set several similar calls, if someone has the inclination to look into fixing this!
I looked into this briefly, and the corresponding ts.LanguageService method is getNavigationTree(), which does in fact return a tree structure rather than a flat list of symbols—it turns out the same LSP call that powers "Go to symbol in editor" (formally, a DocumentSymbol request) also powers the "Outline" pane that many editors have.
What makes this particularly tricky is that editors (or at least Code) don't handle it super well when multiple language servers support that request, and you end up just having multiple roots in your Outline pane with lots of overlapping content, and duplicate entries in the "Go to symbol in editor" list.
I suspect the long-term answer here is probably making glint-language-server slightly more aware of the environment it's operating in, so we can always respond to DocumentSymbol requests for files that tsserver ignores (e.g. .hbs or .gts ones), while only responding to those requests for .ts files if we know that tsserver isn't already doing it.
Probably related:
- https://github.com/typed-ember/glint/issues/633
- https://github.com/typed-ember/glint/issues/676
- https://github.com/typed-ember/glint/issues/692
None of those are related. The comment above yours explains the LSP method we aren't implementing for any source type