VS Code: Difference between revisions
No edit summary |
No edit summary |
||
(20 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[https://code.visualstudio.com/ Visual Studio (VS) Code] is a multi-platform source-code editor developed by Microsoft. It can be used with a variety of programming languages and can have its base functionality extended through | [https://code.visualstudio.com/ Visual Studio (VS) Code] is a multi-platform source-code editor developed by Microsoft. It can be used with a variety of programming languages and can have its base functionality extended through extensions available via its [https://marketplace.visualstudio.com/vscode marketplace]. The base editor itself is free, but some extensions may require paid subscriptions. | ||
There are also forks/open source alternatives of VS Code, such as [https://www.cursor.com Cursor] or [https://vscodium.com/ VSCodium]. The same general principals below apply to these editors as well. | |||
==Cluster Usage== | ==Cluster Usage== | ||
It can be convenient when using our [[SLURM]] computing clusters to open a connection to a VS Code Server session on the submission node(s) that you have access to via VS Code's [https://code.visualstudio.com/docs/remote/ssh Remote - SSH extension]. Steps to set this up can be found [https://code.visualstudio.com/docs/remote/ssh#_installation here]. | It can be convenient when using our [[SLURM]] computing clusters to open a connection to a [https://code.visualstudio.com/docs/remote/vscode-server VS Code Server] session on the submission node(s) that you have access to via VS Code's [https://code.visualstudio.com/docs/remote/ssh Remote - SSH extension]. Steps to set this up can be found [https://code.visualstudio.com/docs/remote/ssh#_installation here]. Use your UMIACS username and the [https://en.wikipedia.org/wiki/Fully_qualified_domain_name fully qualified domain name (FQDN)] of the submission node you want to connect to. Password authentication does not provide an option to save your password, so for convenience, you may want to set up an [[SSH/Keys | SSH key]]. | ||
For a list of active issues with the Remote - SSH extension, please see Microsoft's GitHub tracker [https://github.com/Microsoft/vscode-remote-release/labels/ssh here]. | |||
===Best Practices=== | ===Best Practices=== | ||
Because of the multi-tenant nature of our submission nodes, using the Remote - SSH extension to connect to a VS Code Server running on a submission node can have adverse affects on other users simultaneously using the submission nodes if not properly managed. The following is a list of "best practices" that we ask you please follow to minimize the chance of impacting others on submission nodes. We have compiled the list through observation as well as through discussion with users. | Because of the multi-tenant nature of our submission nodes, using the Remote - SSH extension to connect to a VS Code Server running on a submission node can have adverse affects on other users simultaneously using the submission nodes if not properly managed. The following is a list of "best practices" that we ask you please follow to minimize the chance of impacting others on submission nodes. We have compiled the list through observation as well as through discussion with users. | ||
====Use only as a code editor==== | |||
VS Code can perform many common file management operations, such as moving, copying, or deleting files or directories. However, the overhead of providing progress updates / status messages through VS Code's UI can cause load spikes that result in other processes on the submission node (both system-level and other users') slowing down. This is especially the case if operating on thousands to millions of small image or video files. In extreme cases, it can seem as though the submission node is wholly unresponsive. | |||
The best way to combat this is to use VS Code as just a code editor as strictly as you can (meaning creating new and/or editing existing source code files only). Use standard command-line programs such as <code>mv</code>/<code>cp</code>/<code>rm</code> in VS Code's terminal window or a separate application's terminal window for local file management instead, or use the techniques advertised [[LocalDataTransfer | here]] for larger data transfers between nodes. | |||
====Do not open large files==== | ====Do not open large files==== | ||
Files that you open on a remote machine through the Remote - SSH extension are loaded entirely into RAM on the remote machine. Because of the persistence of VS Code Server processes, opening several unique files may result in them all remaining in RAM for extended periods of time even if you no longer have | Files that you open in VS Code's text editor on a remote machine through the Remote - SSH extension are loaded entirely into RAM on the remote machine. Because of the persistence of VS Code Server processes, opening several unique files may result in them all remaining in RAM for extended periods of time even if you no longer have tabs open for them in the Tab Bar. | ||
As such, please refrain from opening large files (more than a few MB) in VS Code itself on submission nodes. Either use a lighter-weight command-line based text editor such as [https://www.vim.org/ vim] or otherwise on the submission node itself, or first [[ | As such, please refrain from opening large files (more than a few MB) in VS Code itself on submission nodes. Either use a lighter-weight command-line based text editor such as [https://www.vim.org/ vim] or otherwise on the submission node itself, or first [[LocalDataTransfer | transfer]] the files that you would like to open to either a less-used remote machine or your local machine before opening them. | ||
If you absolutely need to open one or more large files for a very brief period of time on a submission node, please clean up your server session on that node (see below section) as soon as possible when done. | If you absolutely need to open one or more large files for a very brief period of time on a submission node, please clean up your server session on that node (see below section) as soon as possible when done. | ||
==== | ====Clean up when done==== | ||
If you are done using VS Code for an extended period of time (several hours / overnight), consider manually killing your server session on the submission node when exiting. By default, VS Code Server will keep the processes used by your session active for a few hours after you disconnect, keeping the | If you are done using VS Code for an extended period of time (several hours / overnight), consider manually killing your server session on the submission node when exiting. By default, VS Code Server will keep the processes used by your session active for a few hours after you disconnect, keeping the VS Code Server processes on the submission node you were using alive, despite no longer actively being used. | ||
This can be done by opening the [https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette Command Palette] (Ctrl+Shift+P) and searching "Kill VS Code Server on Host...". | This can be done by opening the [https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette Command Palette] (Ctrl+Shift+P) and searching "Kill VS Code Server on Host...". | ||
Line 28: | Line 37: | ||
: [[File:VSCode-killremote3.png]] | : [[File:VSCode-killremote3.png]] | ||
The next time you connect to the same submission node, you will have a fresh VS Code session on it. | |||
==Common Issues== | |||
If you are having trouble [[SSH]]'ing to a submission node with VS Code, check if your home directory is full. | |||
# Connect to one of your Nexus submission nodes via [[SSH]] '''not''' using VS Code. | |||
# Navigate to your home directory. <pre>cd ~</pre> | |||
# Check if it is full. <pre>df -h .</pre> | |||
# If it is full (Avail 0), delete some files to free up at least ~100MB of space. <pre>Filesystem Size Used Avail Use% Mounted on data.isilon.umiacs.umd.edu:/ifs/umiacs/homes 30G 30G 0 100% /fs/nfshomes</pre> | |||
# Try connecting with VS Code again. |
Latest revision as of 18:31, 14 November 2024
Visual Studio (VS) Code is a multi-platform source-code editor developed by Microsoft. It can be used with a variety of programming languages and can have its base functionality extended through extensions available via its marketplace. The base editor itself is free, but some extensions may require paid subscriptions.
There are also forks/open source alternatives of VS Code, such as Cursor or VSCodium. The same general principals below apply to these editors as well.
Cluster Usage
It can be convenient when using our SLURM computing clusters to open a connection to a VS Code Server session on the submission node(s) that you have access to via VS Code's Remote - SSH extension. Steps to set this up can be found here. Use your UMIACS username and the fully qualified domain name (FQDN) of the submission node you want to connect to. Password authentication does not provide an option to save your password, so for convenience, you may want to set up an SSH key.
For a list of active issues with the Remote - SSH extension, please see Microsoft's GitHub tracker here.
Best Practices
Because of the multi-tenant nature of our submission nodes, using the Remote - SSH extension to connect to a VS Code Server running on a submission node can have adverse affects on other users simultaneously using the submission nodes if not properly managed. The following is a list of "best practices" that we ask you please follow to minimize the chance of impacting others on submission nodes. We have compiled the list through observation as well as through discussion with users.
Use only as a code editor
VS Code can perform many common file management operations, such as moving, copying, or deleting files or directories. However, the overhead of providing progress updates / status messages through VS Code's UI can cause load spikes that result in other processes on the submission node (both system-level and other users') slowing down. This is especially the case if operating on thousands to millions of small image or video files. In extreme cases, it can seem as though the submission node is wholly unresponsive.
The best way to combat this is to use VS Code as just a code editor as strictly as you can (meaning creating new and/or editing existing source code files only). Use standard command-line programs such as mv
/cp
/rm
in VS Code's terminal window or a separate application's terminal window for local file management instead, or use the techniques advertised here for larger data transfers between nodes.
Do not open large files
Files that you open in VS Code's text editor on a remote machine through the Remote - SSH extension are loaded entirely into RAM on the remote machine. Because of the persistence of VS Code Server processes, opening several unique files may result in them all remaining in RAM for extended periods of time even if you no longer have tabs open for them in the Tab Bar.
As such, please refrain from opening large files (more than a few MB) in VS Code itself on submission nodes. Either use a lighter-weight command-line based text editor such as vim or otherwise on the submission node itself, or first transfer the files that you would like to open to either a less-used remote machine or your local machine before opening them.
If you absolutely need to open one or more large files for a very brief period of time on a submission node, please clean up your server session on that node (see below section) as soon as possible when done.
Clean up when done
If you are done using VS Code for an extended period of time (several hours / overnight), consider manually killing your server session on the submission node when exiting. By default, VS Code Server will keep the processes used by your session active for a few hours after you disconnect, keeping the VS Code Server processes on the submission node you were using alive, despite no longer actively being used.
This can be done by opening the Command Palette (Ctrl+Shift+P) and searching "Kill VS Code Server on Host...".
Select the submission node you were using and click on it.
Wait a few seconds and you should get a message confirming the command went through.
The next time you connect to the same submission node, you will have a fresh VS Code session on it.
Common Issues
If you are having trouble SSH'ing to a submission node with VS Code, check if your home directory is full.
- Connect to one of your Nexus submission nodes via SSH not using VS Code.
- Navigate to your home directory.
cd ~
- Check if it is full.
df -h .
- If it is full (Avail 0), delete some files to free up at least ~100MB of space.
Filesystem Size Used Avail Use% Mounted on data.isilon.umiacs.umd.edu:/ifs/umiacs/homes 30G 30G 0 100% /fs/nfshomes
- Try connecting with VS Code again.