-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework and correct major part of xref glue code
See comments of joaotavora/eglot#314. Up to now, xref-backend-indentifier-completion-table was a gross hack that only worked sometimes. It relied on some fugly gymnastics to cache a response from :textDocument/documentSymbol and somehow used that information to build a completion table. But it doesn't work well. Summarily, LSP doesn't lend itself well to the xref interface of prompting for an arbitrary identifier and then go look for whichever type of references of that identifier. All the LSP :textDocument/{definition,references,implementation,...} methods expect to know the exact context of the search the user is about to perform, in the form of a document location. That conflicts with the xref "arbitrary string" requirement. Therefore, the slightly limited, but much more correct way, for Eglot to function is to override the user's preference of xref-prompt-for-identifier, temporarily setting it to nil in eglot--managed-mode (ideally, though, xref-prompt-for-identifier should be a function of the backend.) Later on, a possibly better behaved identifier completion table can be built on top of the :workspace/symbol LSP method. * eglot.el (xref-backend-identifier-at-point): Rewrite. (eglot--lsp-xrefs-for-method): New helper. (eglot--lsp-xref-helper): Use eglot--lsp-xrefs-for-method. (eglot--xref-definitions-method): Delete. (eglot--lsp-xref-refs): New variable. (xref-backend-references, xref-backend-definitions): Use eglot--lsp-xrefs-for-method. (eglot--managed-mode): Set xref-prompt-for-identifier to nil. (eglot--xref-reset-known-symbols, eglot--xref-known-symbols): Delete (xref-backend-identifier-completion-table): Nullify. (eglot-find-declaration, eglot-find-implementation) (eglot-find-typeDefinition): Use eglot--lsp-xref-helper.
- Loading branch information
1 parent
4c11b0b
commit 7048927
Showing
1 changed file
with
48 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters