Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vscode : Open file locally using Remote-SSH through integrated terminal

I am using Remote-SSH plugin for remote development and would like to open a file in the existing editor using an integrated terminal (which is running a remote shell). A similar issue was posted on fit repository but it doesn't seem to work now.

https://github.com/microsoft/vscode-remote-release/issues/766

Local Machine 1.41.1 26076a4de974ead31f97692a0d32f90d735645c0 Windowsx64

Remote Machine 1.41.0 9579eda04fdb3a9bba2750f15193e5fafe16b959 CentOsx64

Can you help me to debug

like image 659
Ganesh Gore Avatar asked Nov 06 '22 10:11

Ganesh Gore


1 Answers

Copying my answer from https://stackoverflow.com/a/68090934/319542


You shouldn't have to do anything. VSCode automatically sets the path/PATH to the code in the path/PATH environment variable depending on your shell. See this response. You might be overwriting your path/PATH like I was. I was accidentally overwriting path in ~/.cshrc and PATH in ~/.bashrc and was running into the same issue. After fixing it, I can run code on the command line. which code returns the location of the command.

Until I spent time to figure it out, I was using the two methods mentioned below. Both of which worked for me in bash; you can modify it for your shell as you see fit. But really fix your path/PATH rather than using these methods.

  1. Adding location of code to the PATH in ~/.bashrc

    export PATH=${VSCODE_GIT_ASKPASS_NODE%/*}/bin:$PATH

OR

  1. Setting alias to code in ~/.bashrc

    alias code="${VSCODE_GIT_ASKPASS_NODE%/*}/bin/code"


More on path vs. PATH here and here

like image 89
Praveen Lobo Avatar answered Dec 19 '22 02:12

Praveen Lobo