formulahendry / vscode-code-runner

Code Runner for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner
MIT License
2.18k stars 289 forks source link

code-runner with ssh? #369

Open MuhsinFatih opened 5 years ago

MuhsinFatih commented 5 years ago

Is there an ssh option where I can run my code on a remote server, or a way I can achieve this? If not, can this be implemented?

Thanks!

formulahendry commented 5 years ago

We have no special support for ssh, but I think you could customize with code-runner.executorMap, refer to https://github.com/formulahendry/vscode-code-runner#configuration

Biohacking-zhangyp commented 5 years ago
  1. Install Code Runner and SSH FS

  2. Config SSH FS like this: { "label": "label", // must user the root directory "root": "/", "host": "host", "port": port, "username": "name", "password": "password" } }

  3. Add this config into your user setting

"code-runner.runInTerminal": true, "files.eol":"\n", "code-runner.saveFileBeforeRun":true,`

  1. Use your vscode terminal login server over ssh.
MuhsinFatih commented 5 years ago

The way I did this is that normally I had cd $dir at the beginning of every code-runner.executorMap command, I removed them and added code-runner.fileDirectoryAsCwd = false. When I am not using ssh, I can enable cd'ing into cwd by setting this to true, otherwise I use code-runner's terminal to login server over ssh and, cd into the directory myself. Thanks for the help!