ocaml / merlin

Context sensitive completion for OCaml in Vim and Emacs
https://ocaml.github.io/merlin/
MIT License
1.58k stars 233 forks source link

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

Open ManasJayanth opened 1 month ago

ManasJayanth commented 1 month ago

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
voodoos commented 1 month ago

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

voodoos commented 4 weeks ago

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.