I’m using VSCodium 1.89 on an Ubuntu 22.04 OS, and my project uses dune.
The “Go to definition” feature works fine, but not the “autocompletion of values in module” feature.
There is some sort of minimal auto-completion available, where the suggested words
are the words that are already written somewhere in the file.
But what I want is full OCaml_compatible completion, the way it exists in Utop (and exists also in VSCode) : when the module name (followed by a point) is fully written, the suggested words are the values defined in that module.
How can I fix this ?
Here are the extensions I installed on VSCodium :
it’s possible that ocaml platform can’t reach ocamllsp. can you verify you have the lsp server in your path?
In my PATH
I have .opam/default/bin
, which is where my ocamllsp
executable is located.
Please try to run “OCaml: Restart Language Server” in the command palette (Ctrl + Shift + P), and report back eventual error/logs:
I did that and did not get any message at all, whether it be error messages or success messages. Where should I find the logs, if there are any ?
Khady
July 9, 2024, 2:17am
7
In the bottom panel you should have a debug
tab with a dropdown that has 3 ocaml entries.
Instead, I have this in the ‘OUTPUT’ section :
halting dune merlin process
{ pid = pid 11232
; initial_cwd = "/home/jonathandoyle/Teuliou/OCaml/skeptical_duck"
}
closed merlin process
{ pid = pid 11232
; initial_cwd = "/home/jonathandoyle/Teuliou/OCaml/skeptical_duck"
}
[Error - 9:32:57 AM] Server process exited with code 0.
[Info - 9:33:26 AM] Ocamlformat-RPC server started with PID 12457
edwin
July 9, 2024, 10:36pm
9
I only have ‘OCaml Platform’, not ‘OCaml Platform Syntax’. Possibly having 2 won’t work well, try keeping just the ‘OCaml Platform’.
Also what are the versions?
I have these on OCaml 5.2:
opam list --installed ocaml-lsp-server ocamlformat merlin-lib dune ocamlformat-rpc-lib
# Packages matching: (name-match(ocaml-lsp-server) | name-match(ocamlformat) | name-match(merlin-lib) | name-match(dune) | name-match(ocamlformat-rpc-lib)) & installed
# Name # Installed # Synopsis
dune 3.16.0 Fast, portable, and opinionated build system
merlin-lib 5.1-502 Merlin's libraries
ocaml-lsp-server 1.18.0~5.2preview LSP Server for OCaml
ocamlformat 0.26.2 Auto-formatter for OCaml code
ocamlformat-rpc-lib 0.26.2 Auto-formatter for OCaml code (RPC mode)
The OCaml Platform extension is v1.19.1 and VSCodium 1.90.2.
I don’t see this in my log (though the ‘format’ command works), so you are potentially running a different version than me.
1 Like
This seems to work, thx.
My versions are just a little bit behind yours :
$opam list --installed ocaml-lsp-server ocamlformat merlin-lib dune ocamlformat-rpc-lib
# Packages matching: (name-match(ocaml-lsp-server) | name-match(ocamlformat) | name-match(merlin-lib) | name-match(dune) | name-match(ocamlformat-rpc-lib)) & installed
# Name # Installed # Synopsis
dune 3.16.0 Fast, portable, and opinionated build system
merlin-lib 4.16-501 Merlin's libraries
ocaml-lsp-server 1.17.0 LSP Server for OCaml
ocamlformat 0.26.2 Auto-formatter for OCaml code
ocamlformat-rpc-lib 0.26.2 Auto-formatter for OCaml code (RPC mode)
1 Like