ami-iit / ami-commons

In this repository we store tools and utilities shared between our repositories.
11 stars 2 forks source link

Understand how to use Visual Studio Code on Windows and Linux for C++ development with conda/mamba/pixi #22

Open traversaro opened 6 months ago

traversaro commented 6 months ago

At the moment, everyone in the lab using Visual Studio Code with conda/mamba is actually launching code in a terminal in which the environment has been activated. This is cumbersome and complex, it would be great to find an alternative.

Past research on the topic:

traversaro commented 6 months ago

Ok, I think I found a way, still not super ergonomic but it is working:

traversaro commented 3 months ago

This comment https://github.com/prefix-dev/pixi/issues/411#issuecomment-1837234946 is related. They refer to https://github.com/direnv/direnv-vscode, and indeed a possible workaround/workflow is to define a direnv's .envrc file that activates the conda environment?

traversaro commented 3 months ago

I did some quick tests, on Linux the direnv extension work really well, even if you just installed direnv and you did not hooked it to your shell, CMake extensions then find all the C++ dependencies in the conda/pixi environment.

Instead on Windows I was not able to make direnv to work, apparently there are still some issues on the Windows side:

giotherobot commented 3 months ago

Cool! We maybe want to update the suggested extensions to include this then.

traversaro commented 1 month ago

Apparently I never found this (extremely related) issue: https://github.com/microsoft/vscode-cmake-tools/issues/1445 .