In a project that uses OMicroB, vscode is unable to find the cmi files which are installed outside of opam’s sandbox in /usr/local/lib/omicrob
. How can I set up the vscode-ocaml-platform extension to look in that directory? Is there a way to pass --fallback-read-dot-merlin
to ocamllsp used by the extension?
In theory that’s what I need. In practice I’m not able to get it to work. Here’s my vscode config:
{
"ocaml.sandbox": {
"kind": "custom",
"template": "opam exec --switch=4.14.0 --set-switch -- $prog $args --fallback-read-dot-merlin"
}
}
My .merlin
file is fine because it works with vim. But vscode still does not find the cmi’s in /usr/local/lib/omicrob
.
vscode extension has a setting called extraEnv
which allows to pass env vars to ocamllsp, but last I checked this didn’t work for me
edit: this actually works
On a side note: I’m very happy to see support for dot-merlin added back into ocaml-lsp, I’m still a big user of .merlin files.
Anyone know how to pass a command line argument on Emacs lsp-mode?
How can I set up the vscode-ocaml-platform extension to look in that directory? Is there a way to pass
--fallback-read-dot-merlin
to ocamllsp used by the extension?
You’ll want your project-root/.vscode/settings.json to look like this:
{
// whatever
"ocaml.server.args": [ "--fallback-read-dot-merlin" ],
// existing crud
}
You’ll also want to put an empty dune-project file in your project root directory because of an ocaml-lsp bug: .merlin based projects still require a blank dune-project file · Issue #859 · ocaml/ocaml-lsp · GitHub.
This works for me on a very small project that is built with a tiny bash script and has an extremely simple 7 line long .merlin file.