Dune promotions in ocamllsp (via dune rpc)

Hey everyone,

I’m currently implementing some custom integration for ocaml in neovim. As part of this I’m integrating ocamllsp into neovim beyond the basic lspconfig. I’ve come across the dune/promote custom command and saw on the ocamllsp README that it supports promotion diagnostics and promoting in case a dune process is running (dune build/exec -w) via dune RPC.

The problem is that neither diagnostic nor the actual promoting seem to work (and neither does it for me in VS Code).

I’m also not entirely sure how this should work in dune in the first place. After some investigation I’ve noticed that dune runtest will create the _build/.to-promote file, which contains the files to be promoted. Running dune build (or dune build -w) will delete this file and dune promote list will show no available promotions. Is this a bug in dune, or am I doing something wrong?

1 Like

Ok, running dune runtest -w rather than dune build -w somewhat works. The promotion is reported in the LSP diagnostics (but range is from [0,0] - [0,0]), and dune/promote will promote the file as expected.