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
It just took me way too long to figure out why ocaml-lsp did not work correctly when adding dune-project and dune files to my repository. Highlighting partially was off (No semantic highlighting?)
And on document hover it returned the following, confusing error message:
ocamllsp: -32600: no document found with uri: file:///home/user/projects/ocaml-lsp-test-project/hello/bin/main.ml
`:LspLog`
[ERROR][2024-12-09 22:09:52] .../vim/lsp/rpc.lua:770 "rpc" "/etc/neovim-nix-dependencies/bin/ocamllsp" "stderr" 'Uncaught error when handling notification:\n{\n "params": {\n "textDocument": {\n "version": 115,\n "uri": "file:///home/user/projects/ocaml-lsp-test-project/hello/bin/main.ml"\n },\n "contentChanges": [\n {\n "rangeLength": 1,\n "range": {\n "end": { "character": 0, "line": 108 },\n "start": { "character": 38, "line": 107 }\n },\n "text": "\\nlet () = print_endline \\"Hello, World!\\"\\n"\n }\n ]\n },\n "method": "textDocument/didChange",\n "jsonrpc": "2.0"\n}\nError:\n[ { exn =\n "jsonrpc response error {\\n\\\n \\ \\"code\\": -32600,\\n\\\n \\ \\"message\\": \\"no document found with uri: file:///home/user/projects/ocaml-lsp-test-project/hello/bin/main.ml\\"\\n\\\n }"\n ; backtrace =\n "Raised at Jsonrpc.Response.Error.raise in file \\"jsonrpc/src/jsonrpc.ml\\", line 186, characters 18-29\\n\\\n Called from Ocaml_lsp_server__Document_store.change_document in file \\"ocaml-lsp-server/src/document_store.ml\\", line 132, characters 12-22\\n\\\n Called from Ocaml_lsp_server.on_notification in file \\"ocaml-lsp-server/src/ocaml_lsp_server.ml\\", lines 743-744, characters 6-62\\n\\\n Called from Lsp_fiber__Rpc.Server.h_on_notification.(fun) in file \\"lsp-fiber/src/rpc.ml\\", line 413, characters 23-52\\n\\\n Called from Fiber__Scheduler.exec in file \\"fiber/src/scheduler.ml\\", line 73, characters 8-11\\n\\\n "\n }\n]\n'
This was surprising, because earlier, without the dune configuration files, both worked fine.
Apparently ocaml-lsp needs to invoke dune. This was not obvious. Especially, because ocaml-lsp was successfully talking to my dune build -w process, and displaying its errors!
Later i found the real error hidden somewhere earlier in the logs:
It just took me way too long to figure out why ocaml-lsp did not work correctly when adding
dune-project
anddune
files to my repository. Highlighting partially was off (No semantic highlighting?)And on document hover it returned the following, confusing error message:
`:LspLog`
This was surprising, because earlier, without the dune configuration files, both worked fine.
Apparently ocaml-lsp needs to invoke
dune
. This was not obvious. Especially, because ocaml-lsp was successfully talking to mydune build -w
process, and displaying its errors!Later i found the real error hidden somewhere earlier in the logs:
`:LspLog`
Solution: Add dune to the ocaml-lps's PATH
Maybe:
Or do nothing, others can now find this issue when searching for the misleading error message ;)
The text was updated successfully, but these errors were encountered: