0

I would like to use Visual Studio Code to compile and debug projects (C++, Nim), but I don't want to add the tool paths to my global Windows PATH settings, to avoid conflicts with other applications. In particular, I don't want to add the MinGW path.

How can I setup Visual Studio Code to add a path for all the tools - not only the terminal?

What I have tried

I saw a few similar questions, including this one which is somewhat outdated but has a few recent comments. I changed my VCS user settings by adding this:

"terminal.integrated.env.windows": {
    "PATH": "${env:PATH}c:\\dev\\msys64\\mingw64\\bin"
},

and sure enough, if I open a terminal and type gcc, it executes normally, or if I check $env:PATH, I can see that it is set as expected.

But when I do Start debugging or Run without debugging from the editor, it fails:

Problems loading reference 'vscode://schemas/ignoredSettings': Unable to load schema from 'vscode://schemas/ignoredSettings': cannot open vscode://schemas/ignoredSettings. Detail: Unable to resolve text model content for resource vscode://schemas/ignoredSettings.

Note that it works fine if I add the MinGW bin path to my Windows PATH instead, but that's what I'm trying to avoid.

RedGlyph
  • 11,309
  • 6
  • 37
  • 49
  • 2
    create a batch file or powershell script file that modifies the PATH and start VSC, call this script/batch file from the terminal outside VSC – rioV8 Feb 19 '23 at 15:51
  • @rioV8 Yes, that was the plan B, but I'm hoping for a smoother solution, that I can use seamlessly when launching VSC from the menu, the console or other apps. If I don't find anything else, I'll create a small executable that does exactly what you suggest. – RedGlyph Feb 20 '23 at 12:02

0 Answers0