An alternate method to configure Visual Studio Code for development on the CSE server is using the SFTP plugin, however to use VSCode on the CSE server with the SFTP plugin. This method uses far more disk space on the CSE server than must have the bash login shell selected. You can change or view your login shell using the AMU account management interface application.
After installing VS Code using the above link, you will need to install the SFTP extension. Use the 'Preferences' link from the VS Code menu to access the Extensions (Mac view:)
VS Code will then open the left-panel showing the extensions. Into the search window, enter 'ssh' to find the Remote - SSH extension and install it.
With Remote - SSH installed, you now need to modify the settings.json file with the configuration required for Remote - SSH. Press function key F1 and enter Preferences:json at the prompt:
This opens an editor window. This file dictates how Remote - SSH communicates with a remote. Add the lines shown:
The "showLoginTerminal": true, option opens a shell prompt to the Linux host and is optional.
With these settings you can initiate a connection by clicking on the Remote Explorer icon and the connect to server icons, labeled 1 and 2 below:
This causes a new window to open with a connection to the cse.unl.edu server. The indication that you are connected can be seen in the lower left-corner.
Now you can Open a folder..., create a new file, or otherwise edit any file you have access to on the CSE server.
Compilation or execution of your source code can be done from within any 'ssh' session to the CSE server, including the login window displayed by Remote - SSH configuration setting with settings.json. See the accompanying section on compilers and interpreters.
Shared SSH Keys
If you are frequently connecting to the CSE server, you can create a public/private SSH key-pair on your laptop or desktop system and "share" the public key with the CSE server. VSCode can then be configured to use the local SSH public/private keys when connecting to CSE and no longer needs a password because CSE knows your public SSH key, and thus grants access to your laptop or desktop.
Disk Usage Considerations
Using VS Code via Remote - SSH utilizes a large amount of disk space within your home directory on the CSE server. This disk usage is caused by two mechanisms; the server-side support for VS Code (VS Code Server) and VS Code extensions. Even with normal usage, VS Code frequently creates additional copies of itself within your home directories on the CSE server as part of the VS Code startup auto-update. You will need to periodically identify and remove these extra copies.
How to determine where disk space is being used for VS Code and extensions is described in the next section.
If your primary disk space usage is not related to VS Code directories (.vscode and .vscode-server), you can determine where your disk usage is greatest by logging into the CSE server and executing the command: du -hd1
which will show a list of all directories and the amount of disk space used in (B)ytes, (K)ilobytes, (M)egabytes, and (G)igabytes.
If you still have disk quota issues despite clearing VS Code related files or are unable to determine the cause of excess disk usage, contact us support@cse.unl.edu .
Managing Disk Usage and Extra Copies of VS Code Server
Using the Remote - SSH extension triggers the installation of a 100MB+ image of the VS Code Server into your home directory on the CSE server. Under certain conditions, you may have multiple copies of the VS Code Server application being placed in a subdirectory of your home directory. This may be related to; using a login shell other than 'bash', version updates to VS Code Server, or as an undocumented artifact of how VS Code behavior. These old/extra copies count against your disk quota on the CSE server, and may result in you receiving disk quota exceeded emails from CSE Systems Support. These old/extra copies can safely be removed, an easy way to tell is if the date reported by 'ls -lt' is the most recent, that is the copy to keep. All older copies can be safely removed.
Below is an example of locating and removing extraneous copies of VS Code:
# List all copies of VS Code, only the most recent (date) is required wmotycka@cse:~> ls -lt ~/.vscode-server/bin/ total 12 drwxr-xr-x 6 wmotycka staff 4096 Oct 26 07:54 d2e414d9e4239a252d1ab117bd7067f125afd80a # NOTE OLDEST DATE drwxr-xr-x 6 wmotycka staff 4096 Nov 8 09:00 fcac248b077b55bae4ba5bab613fd6e9156c2f0c # NOTE OLD DATE drwxr-xr-x 6 wmotycka staff 4096 Jan 16 08:55 ea3859d4ba2f3e577a159bc91e3074c5d85c0523 wmotycka@cse:~> cd ~/.vscode-server/bin # This is the size used by all the copies of VS Code server wmotycka@cse:~/.vscode-server/bin> du -hs 317M . # Here are the specifics of how much disk space each copy of VS Code server is using wmotycka@cse:~/.vscode-server/bin> du -hd1 112M ./d2e414d9e4239a252d1ab117bd7067f125afd80a 104M ./ea3859d4ba2f3e577a159bc91e3074c5d85c0523 103M ./fcac248b077b55bae4ba5bab613fd6e9156c2f0c 317M . # Remove the extra/oldest copy/copies of the VS Code Server using 'rm -r' wmotycka@cse:~/.vscode-server/bin> cd ../.. wmotycka@cse:~> rm -r ~/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a wmotycka@cse:~> rm -r ~/.vscode-server/bin/fcac248b077b55bae4ba5bab613fd6e9156c2f0c wmotycka@cse:~>
The last two commands above remove the oldest copies of VS Code Server images while retaining the most recently dated copy present.
Server Installed VS Code Server Extensions
Where you install VS Code extensions is also important. Extensions stored on the server can use a lot of disk space, and also count against your quota. To add to the pain, VS Code Server seems to build a cached copy of the extensions installed on the server, with a near doubling of used disk space. Further, after uninstalling the extension using the VS Code client, the extensions on server persist. It is recommended that you should avoid installing extensions on the server unless necessary. If you install and uninstall extensions, ensure that they are removed from your ~/.vscode-server/extensions
directory on the CSE server.
An example of where extensions are the cause of CSE server disk space utilization can be seen below. All extra copies of VS Code Server were removed, yet the disk space usage for VS Code Server is still over 500 MB. We note from the output of the du
command below that the space is being used within ~/.vscode-server/extensions
, using 440MB of storage. Deeper examination within the extensions subdirectory reveals that the largest disk space consumer is the tabnine-tabnine-vscode-3.2.6
extension. In this case, the user had uninstalled this extension from VS Code using the client, but VS Code Server apparently doesn't remove them from disk once installed.
wmotycka@cse:~> du -hd1 .vscode-server/ 104M .vscode-server/bin 241M .vscode-server/data 440M .vscode-server/extensions 784M .vscode-server/ wmotycka@cse:~> du -hd1 .vscode-server/extensions/ 8.0K .vscode-server/extensions/ms-vscode.cpptools-1.1.0-insiders3 2.0M .vscode-server/extensions/formulahendry.code-runner-0.11.2 59M .vscode-server/extensions/ms-vscode.cpptools-1.2.0 312K .vscode-server/extensions/albert.tabout-0.2.0 9.0M .vscode-server/extensions/joeberria.statusbarerror-0.4.0 299M .vscode-server/extensions/tabnine.tabnine-vscode-3.2.6 16M .vscode-server/extensions/streetsidesoftware.code-spell-checker-1.10.2 19M .vscode-server/extensions/esbenp.prettier-vscode-5.8.0 36M .vscode-server/extensions/visualstudioexptteam.vscodeintellicode-1.2.11 996K .vscode-server/extensions/gruntfuggly.todo-tree-0.0.196 640K .vscode-server/extensions/austin.code-gnu-global-0.2.2 440M .vscode-server/extensions/ wmotycka@cse:~> ls -dl .vscode-server/extensions/tabnine.tabnine-vscode-3.2.6 drwxr-xr-x 6 wmotycka ugrad 4096 Feb 4 08:54 .vscode-server/extensions/tabnine.tabnine-vscode-3.2.6 wmotycka@cse:~> rm -r .vscode-server/extensions/tabnine.tabnine-vscode-3.2.6 wmotycka@cse:~>