Visual Studio Code (vscode) Configuration Tweaks

From UCSC Genomics Institute Computing Infrastructure Information

Visual Studio Code (vscode) is a popular IDE used for writing code, and many people use the remote functionality feature to edit code on a remote server, which is very cool. But the issue with vscode is that it frequently opens way to many files on the remote server in an attempt to cache search databases and code modifications, and that unnecessarily puts a large burden on the remote server kernel for caching filehandles an such, slow down the remote filesystem and server you are working on.

The fix seems to be to edit this file on the remote server:

 ~/.vscode-server/data/Machine/settings.json

Create that file if it does not already exist. Then put the following text in it:

{
 "search.exclude": {
   "**/node_modules": true,
   "**/bower_components": true,
   "**/env": true,
   "**/venv": true
 },
 "files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/*/**": true,
   "**/.cache/**": true,
   "**/.conda/**": true,
   "**/.local/**": true,
   "**/.nextflow/**": true,
   "**/env/**": true,
   "**/venv/**": true,
   "**/work/**": true,
   "**/private/groups/**": true
 }
} 

Then close vscode. The most reliable is to click on the bottom left where it usually says "SSH: mustard.prism" (or whatever server you are connected to). That populates the dropdown from the search bar, and at the bottom there is an action: "Close Remote Connection". Otherwise it seems to reconnect, stay connected in the background sometimes. Then save any open files you have in vscode and close vscode on your laptop or workstation, then re-open it.