Installing the VsCoq2 Language Server
Install Ocaml
- Install OCaml
Create an opam switch for Coq
-
Check version of installed OCaml:
$ ocaml --version The OCaml toplevel, version 5.1.0
-
Create the switch:
$ opam switch create with-coq 5.1.0
Note that the switch name
with-coq
and the succeeding OCaml version may change. -
Restart shell or run
$ eval $(opam env)
- (Optional). Update opam repo and identify version of Coq available in the repo.
$ opam update ... $ opam list coq ... coq.8.17.0 -- The Coq Proof Assistant coq.8.17.1 -- The Coq Proof Assistant coq.8.18.0 -- The Coq Proof Assistant
-
Pin Coq
$ opam pin add coq 8.18.0
- Decide to whether to install from the opam repo or from a source repository.
Option 1. Installing from opam.ocaml.org
, recommended
-
Install the package:
opam update opam install vscoq-language-server
Option 2. Installing from source
-
Clone the repo:
$ git clone https://github.com/coq-community/vscoq --single-branch
-
Pin from directory:
$ opam pin add vscoq/language-server/
Identify the vscoqtop path
-
Identify path to
.opam/
. It’s normally~/.opam
, but you can check with:$ opam config list <><> Global opam variables ><><> ... root /Users/dashadower/.opam # The current opam root directory ...
-
The vscoqtop binaries are in the path
./opam/YOUR_SWITCH_NAME/bin
. -
Open VSCode preferences, search for vscoq, and fill in
path to vscoqtop
**Make sure any terminal you’re invoking coq binaries with are synced with the switch that vscoq was installed with. **
Run $opam switch
to double-check the coqc you’re about to use is the same version with vscoq’s. If it gives you a warning, you need to run $ eval $(opam env)
.
When vscoq bugs out
- Open command pallete with F1.
- search for
Developer: reload window
. It should reload the extension which should sort most problems.
Written on September 28, 2023