GreenieQwQ
GreenieQwQ

Reputation: 1

How to use go-to-definition with ocamlbuild on VS code?

I am trying to explore the project: https://github.com/kupl/VeriSmart-public. I am trying to use the go-to-definition feature of VS code but it is not working even with the offical Ocaml extension installed.

I've installed opam and used switch ocaml 4.10.0 and can succesfully build the repository following the build script (which is simply a ocamlbuild command). Moreover, I've tried almost all the relative ocaml extensions in VS code (even deprecated).

I think the problem might result from the fact that the codes are written for ocamlbuild instead of dune. So is there any way to use the go-to-definition for the repository on VS code?

Upvotes: 0

Views: 246

Answers (1)

gasche
gasche

Reputation: 31459

Dune has built-in support for generating configuration files that Merlin can consume to know how to work with your projects (where to find build artifacts, and which dependencies to load to make sense of the types in your code). If you are using another build system, you can write a .merlin file by hand.

See the Merlin documentation on .merlin files. It is very easy. Typically the following may be enough:

# where to find the build artifacts
B _build/**

# list your dependencies here (ocamlfind package names)
PKG unix containers cmdliner 

Upvotes: 0

Related Questions