vscode - feliyur/exercises GitHub Wiki

Downloading vscode-server manually

edited: May 2022.

When remote-ssh is slow to load vscode-server can try to upload server to remote machine manually (e.g. if there is connection to it from another machine with internet).

wget  https://update.code.visualstudio.com/commit:c3f126316369cd610563c75b1b1725e0679adfb3/server-linux-x64/stable

Can check the commit id in vscode Help -> About.

Copy it to your machine through ssh.

Unpack to ~/.vscode-server/bin/c3f126316369cd610563c75b1b1725e0679adfb3

target_dir=~/.vscode-server/bin/c3f126316369cd610563c75b1b1725e0679adfb3
mkdir -p $target_dir 
tar -xvf stable -C $target_dir    # target_dir must exist
pushd $target_dir
mv vscode-server-linux-x64/* ./ && rmdir vscode-server-linux-x64
rm stable

Solution taken from here.

Attaching to tmux

  1. In user settings json, add under terminal.integrated.profiles.osx or terminal.integrated.profiles.linux according to remote host:
"terminal.integrated.profiles.linux": {
  //...existing profiles...
  "tmux-shell": {
    "path": "tmux",
    "args": ["new-session", "-A", "-s", "vscode:${workspaceFolder}"]
  }
}
  1. Set tmux as the default terminal profile: "terminal.integrated.defaultProfile.linux": "tmux-shell"

Taken from here

Testing Tricks

Passing environment variables into tests (e.g. CUDA_VISIBLE_DEVICES)

Create a .env file in the project root dir, example content:

CUDA_VISIBLE_DEVICES = "0,1"

Launch configuration to debug tests:

"purpose": [
    "debug-test"
 ]

then

       {
        "name": "Debug Tests",
        "type": "python",
        "request": "test",
        "console": "integratedTerminal",
        "python": "${command:python.interpreterPath}",
        "justMyCode": false,
        "purpose": [
            "debug-test"
        ],
        "env": {
            "MY_ENVIRONMENT_SWITCH_FOR_WRITING_JPEGS": "1"
        }

Taken from here.

Troubleshooting

Symptom Solution
"XHR Failed" when using remote-ssh Try manually installing remote server
certificate errors when doing remote-ssh from windows to unix Add MACs [email protected] to host config in .ssh/config (locally on Windows).
Python code folding not working User Settings => Editor: Default Folding Range Provider => Pylance (and not Python)