Quantcast
Viewing all articles
Browse latest Browse all 521

Setting up dune --root inside VS Code

I’m currently on a somewhat unusual setting: I am updating some documentation inside a dune project, and this documentation has some example code which constitutes an independent dune project itself (the code is supposed to be used outside of a dune-project, on its own).

So, to ensure my “inner” project builds correctly, I am using --root . when running dune build, dune exec, etc. Everything works fine: --root . does exactly what I need.

Now, I’d like to open the .ml code on VS Code. But when I do so, it (naturally) ends up getting the parent dune-project, because I don’t know how to pass the --root . information to VS Code. For instance, I could not find a DUNEROOT environment variable, equivalent to OPAMROOT.

I am using the OCaml Platform (v1.10.7) extension for VS Code. I did not find any settings in it to be able to add --root . to the command line, so VS Code fails to build the code with messages such as “Try calling dune build” (which I already did, with added --root .).

Does anyone know if there is a way to handle this case in VS Code? I could temporarily copy the inner project directory to /tmp and work from there (and if I do so, it works), but then I have to manually synchronize it back before committing, which is cumbersome and error prone.

Is there some environment variable or alternative way to set this up?

2 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 521

Trending Articles