merlin icon indicating copy to clipboard operation
merlin copied to clipboard

Go-to-definition (via LSP) fails in merlin sourcetree when symbols are from copied sources

Open ManasJayanth opened this issue 1 year ago • 2 comments

I used Emacs with Eglot with opam exec -- ocamllsp as the language server command.

In mpipeline.ml when I try to run go-to-definition on Pparse.apply_pp - it fails. If it run it on just Pparse it takes me to the compiler-libs instead of taking me to vendored/patched source files in src/ocaml/driver/pparse.ml

https://github.com/ocaml/merlin/blob/c76379cdaeb429459c9ecfc2990936eb8a36980a/src/kernel/mpipeline.ml#L240-L242

additional information

$ opam exec -- ocamllsp --version
1.19.0
$ opam exec -- ocaml --version
The OCaml toplevel, version 5.2.0

ManasJayanth avatar Sep 27 '24 04:09 ManasJayanth

Thanks for your report, I was able to reproduce it.

voodoos avatar Sep 27 '24 08:09 voodoos

So it is due to the fact the the pparse module is copied via a Dune rules and Merlin doesn't use the added line directive to resolve the correct path. Copy directives support is very lacking right now.

voodoos avatar Oct 11 '24 14:10 voodoos