Xref backend without tunneling#72
Closed
xvw wants to merge 11 commits into
Closed
Conversation
af3d3ce to
774c815
Compare
catern
suggested changes
Nov 5, 2025
b799285 to
264a6ea
Compare
catern
reviewed
Nov 5, 2025
catern
reviewed
Nov 5, 2025
catern
reviewed
Nov 5, 2025
catern
reviewed
Nov 5, 2025
860a15e to
79c8e1d
Compare
79c8e1d to
ced74d3
Compare
catern
suggested changes
Jan 16, 2026
ced74d3 to
9658aac
Compare
catern
suggested changes
Jan 19, 2026
1f25499 to
a9228ce
Compare
catern
suggested changes
Jan 19, 2026
0accb84 to
f6cef25
Compare
catern
suggested changes
Jan 26, 2026
| ;; The LSP doesn't support jumping to definition of an arbitrary identifier, | ||
| ;; so we have to fallback on ocamllsp/locate. | ||
| (if-let* ((locate-result | ||
| (ocaml-eglot-req--send |
Contributor
There was a problem hiding this comment.
Can you try using eglot--lsp-xrefs-for-method for this case?
Member
Author
There was a problem hiding this comment.
I try this implementation:
(cl-defmethod xref-backend-definitions ((_backend (eql ocaml-eglot-xref)) symbol)
"Extension of `xref-backend-definitions' for SYMBOL."
(if-let* ((pt (get-text-property 0 'eglot--lsp-workspaceSymbol symbol)))
;; SYMBOL is from `xref-backend-identifier-at-point',
;; since if it was read from the minibuffer its text
;; properties would have been stripped
;; (see `minibuffer-allow-text-properties'). Just pass
;; position and Merlin will figure out everything from that.
(eglot--lsp-xrefs-for-method
(if (eq ocaml-eglot-locate-preference 'mli)
:textDocument/declaration
:textDocument/definition))
;; The LSP doesn't support jumping to definition of an arbitrary identifier,
;; so we have to fallback on ocamllsp/locate.
(eglot--lsp-xrefs-for-method
:ocamllsp/locate
:extra-params (list :kind (if (eq ocaml-eglot-locate-preference 'mli)
"declaration"
"definition")
:prefix (string-remove-suffix "." symbol))
:capability :experimental/ocamllsp/handleLocate)))But it leads to the following issue: [eglot] Unsupported or ignored LSP capability 'ocamllsp/handleLocate' and if I avoid capability it try to use locateProvider so it seems blocked.
f6cef25 to
3fd16c3
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR make two things:
ocaml-eglot-locatewith a behaviour similar tomerlin-locate(based on preference)merlinCallCompatiblefor finding definition/declaration