Apart from using dune in watch mode, there’s another caveat to keep in mind: lsp only type checks your source after you edit it. So if your source becomes invalid because you’ve edited the interface of some other module that’s a dependency, you will not see the error the reflected in your editor until you save an edit.
In dune 3.0, we’re going to have deeper integration with watch mode. It shouldn’t be too hard to think of a workaround for this issue.