I’m getting my whole lsp ecosystem working in emacs under eglot, and I’m wondering if the reference finding in ocaml-lsp only works inside the buffer the request is in. For example, in Python and TypeScript it works across the entire project. I’m trying to determine if this is an issue in my configuration or how the LSP works.
If it only currently works inside the same buffer, are there any plans to extend it to be the entire project?
Is there any documentation about the advantages of using OCaml-LSP over Merlin directly? E.g. is this find-references from Merlin or something else? My brief check seemed to indicated that OCaml-LSP is mostly a wrapper around Merlin.
The reason I want it is because the LSP’s have a common interface so its unifying all of my configuration and interfaces. I switch between 3 or 4 languages daily and it’s nice in that regard.
Right now, find references only works on a single file. There’s an open issue on the merlin repository: Global API search · Issue #61 · ocaml/merlin · GitHub.
Perhaps it’s an issue with my setup, but find references doesn’t work for record fields even inside a single buffer, e.g. when the field is a part of a pattern match on a record.
Apart from unifying the interface as @orbitz mentioned, LSP (eglot or LSP-mode) does it’s thing more asynchronously then merlin’s emacs integration. For example in a larger buffer I can see merlin adding a lot of latency to typing with completion, while eglot seemingly does not.
The biggest difference as of today is that LSP integrates with dune’s watch mode better. This means that LSP will show project global diagnostics (from dune) when watch mode is turned on.
Good to know! I guess at some point I might revisit it OCaml-LSP then.
Can anybody describe why whole project analysis is not done? Do we have any fundamental stopper?
I think merlin has all the necessary infrastructure. Someone just needs to build it. It could be you!
Project-wide occurrences is actually a feature that is being actively worked-on in Merlin ! (and because ocaml-lsp uses merlin under the hood it wil get it shortly after)
Glad to hear that.
I hope that indexing of a whole project will not take 6 cores and 6 GB of memory (I observed things like that with IntelliJ Idea)