Search code examples
visual-studio-codemsys2

Open VSCode from MSYS2 with 'code' command


I am not able to open a Visual Studio Code window from a MSYS2 terminal using the code command (command not found error). I have thoroughly followed the steps mentioned in the official guide and both MSYS2 and VSCode bin folders are on my Path variable.

Although this is not a deal breaker, as one can open the folder in VSCode and then navigate to the directory in MSYS2 in the integrated terminal, it does cause some minor inconvenience.


Solution

  • The root of the problem was that VSCode's bin directory was not added to MSYS2's PATH (thanks to user's comment). There was no mention of doing this as a method of troubleshooting in the official guide, so I have opened an issue there.

    The following line of command fixed the problem for me:

    PATH=/c/Users/[username]/AppData/Local/Programs/'Microsoft VS Code'/bin:$PATH