OCaml LSP: poor recognition of references across file modules

Hi all!

I’ve noticed that if I define a variable/function (any symbol) foo in one file a.ml, which gets referenced in another file b.ml, I will have to rebuild before the LSP recognizes foo in b.ml. I suspect this is due to the separate compilation etc. whereby the interface has been compiled and the LSP reads from this compiled (stale) interface instead of an updated one containing the symbol foo.

Additionally, renaming a symbol in one file fails to rename it in other files where they are mentioned. This is true whether or not the file module is opened.

How can I achieve the behavior whereby I need not re-run dune build to get rid of the LSP errors?

You can build in watch mode to solve that problem. dune build -w.

This isn’t supported for now. There’s development going on though, so hopefully soon.