vscoq icon indicating copy to clipboard operation
vscoq copied to clipboard

Picking opam switches for VsCoq2 server from inside VS Code

Open palmskog opened this issue 1 year ago • 3 comments

Most users of VsCoq2 are installing the LSP server via opam and may have several different switches with different Coq versions. Hence, it would be useful to (optionally) specify a specific opam switch to use inside VS Code, i.e., to explicitly specify the switch from which to find vscoqtop. A user may want change between different opam switches several times during a VS Code session.

This is related to issue #640.

palmskog avatar Sep 28 '23 11:09 palmskog

The extension https://github.com/ocamllabs/vscode-ocaml-platform implement such a switch. I wonder if we could just depend on it, or something like it.

gares avatar Sep 28 '23 13:09 gares

@gares I played around with implementing that in VsCoq1 not so long ago, I can share the code later if it is useful to you. The OCaml-platform extension doesn't expose an API to get the current switch, so we would have to convince the maintainers to expose those parts in the extension exports.

I seem to recall that there were a few minor downsides to depending on OCaml-platform extension

  • The extension doesn't activate until a .ml file is opened or the "OCaml" side-panel is opened. So the API also wouldn't be available until that happens.
  • You have to install the ocaml-lsp-server package in all your switches otherwise you get an annoying warning every time you open VS Code.

4ever2 avatar Sep 28 '23 14:09 4ever2

For me, the ocaml platform extension activates when I have a Coq file open and then I can do opam switch, but indeed it complains about not finding the server every time.

TheoWinterhalter avatar Sep 28 '23 14:09 TheoWinterhalter