You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/bin/sh
cat >dune-project <<EOF(lang dune 3.11)EOF
cat >main.ml <<EOFopen Liblet () = print_string vEOF
cat >lib.ml <<EOFlet v = "42"EOF
cat >dune <<EOF(executable (name main) (modules main) (libraries lib))(library (name lib) (modules lib))EOF
opam switch create . 5.1.0
ocaml-platform
# Inferring tools version...# -> dune.3.11.1 will be built from source# -> dune-release.2.0.0 will be installed from cache# -> merlin.4.12-501 will be installed from cache# -> ocaml-lsp-server.1.16.2 will be installed from cache# -> odoc.2.3.0 will be installed from cache# -> ocamlformat.0.26.1 will be installed from cache
dune build
####################### No issue with manual builds# 1. Introduce an error in lib and rebuild:# cat >lib.ml <<EOF# let v : float = "42"# EOF# 2. Now lsp says, in main.ml:# ocamllsp: Unbound module Lib# 3. Fix the error and rebuild:# cat >lib.ml <<EOF# let v = "42"# EOF# 4. lsp has no more errors######################### But with dune -watch# 1. Run `dune build -w`# 2. Introduce the same error than before# 3. LSP shows unbound module error in main.ml# 4. Fix the issue, dune should rebuild ok# 5. Go back to main.ml. Unbound module error stays even after edit, even after# exiting and restarting dune. Only restarting the lsp removes the stalled# error.
@rgrinberg : I guess the issue is likely due to Dune RPC since manual dune builds don't triggers it. It happens quite often when working on a project with dune watch active.
It's not 100% reproducible in my project, but the following seems to work:
let x = "a" + 42
at the bottom)Unbound module Compare
(somewhat expected, as there is no mli)Unbound module Compare
error in main.ml is still thereRelevant for reproduction, I open both files in the same vim instance, and use the following to autosave on every change:
Restarting lsp fixes the issue. Other changes to either ml file seem to preserve the issue.
Here is a recording: https://asciinema.org/a/6HG60xy5grl0hlF5BxMcxxPLK
And the lsp logfile: lsp.log
The text was updated successfully, but these errors were encountered: