Difference between revisions of "VS Code"

From Computer Science
Jump to: navigation, search
(Extensions)
(Extensions)
 
(2 intermediate revisions by the same user not shown)
Line 13: Line 13:
 
** Remote SSH: Editing Configuration (by Microsoft)
 
** Remote SSH: Editing Configuration (by Microsoft)
 
** Remote Explorer (by Microsoft)
 
** Remote Explorer (by Microsoft)
 +
* Python (by Microsoft) - allows you to run and debug Python code within VS Code.  '''But note''' - you should not install this extension while connected to the CS server as this eats up a fair amount of space on the CS server.
  
 
'''Be careful'''
 
'''Be careful'''
Line 24: Line 25:
  
 
=Connecting to CS Server=
 
=Connecting to CS Server=
Click on the Remote Explorer icon on the left, click + to add a new connection, and put in your username@cs.indstate.edu. You may need to quit VS Code and start it again, but you should see the connection listed. You can click the arrow icon to connect with the current window or click the window button to connect in a new window.  
+
Click on the Remote Explorer icon on the left, click + to add a new connection, and put in your username@cs.indstate.edu. ''You may need to quit VS Code and start it again'', but you should see the connection listed. You can click the arrow icon to connect with the current window or click the window button to connect in a new window.  
  
 
At this point when you Open, Save, etc. files, they will be on the CS server.
 
At this point when you Open, Save, etc. files, they will be on the CS server.
Line 33: Line 34:
  
 
If you want to '''close the remote connection''' you can click on the connection icon in the lower left of the window and choose to close the remote connection. Then you would be looking at files on your personal computer again.
 
If you want to '''close the remote connection''' you can click on the connection icon in the lower left of the window and choose to close the remote connection. Then you would be looking at files on your personal computer again.
 +
 +
If you have multiple accounts on the CS server, you can create multiple Remote Explorer entries. If you click the gear by SSH in the Remote Explorer pane, you can click to edit the configuration file to change how these are displayed. For example, this configuration file lists two accounts for Jeff Kinne.
 +
<pre>
 +
Host jkinne@cs.indstate.edu
 +
  HostName cs.indstate.edu
 +
  User jkinne
 +
 +
Host cs51000@cs.indstate.edu
 +
  HostName cs.indstate.edu
 +
  User cs51000
 +
</pre>

Latest revision as of 15:24, 23 March 2023

This page contains some information on proper setup of VS Code to use on your home computer and have it connect to the CS server.

Download/install

  • Download and install from here - https://code.visualstudio.com/download
    • On Linux, you might install using the package manager for your system (it varies by distribution).
    • On Mac, the downloaded file is not an installer. You should drag the downloaded file into your Application folder and run it from there.

Extensions

To install extensions you click on one of the icons on the left hand side of the Visual Studio Code window.

Recommended extensions

  • Remote SSH (by Microsoft) - allows you to connect to the CS server and run a terminal from within VS Code. Installing this will also install the following normally, which are also recommended.
    • Remote SSH: Editing Configuration (by Microsoft)
    • Remote Explorer (by Microsoft)
  • Python (by Microsoft) - allows you to run and debug Python code within VS Code. But note - you should not install this extension while connected to the CS server as this eats up a fair amount of space on the CS server.

Be careful

  • When you install extensions and are doing development remotely on the CS server, some try to install large installation files on the CS server. The above do not. You can check what has been installed and how much space they are taking up with the following commands from a terminal:
cd ~/.vscode-server
ls -lh extensions
du -d 1 -h extensions
du -d 1 -h .

Connecting to CS Server

Click on the Remote Explorer icon on the left, click + to add a new connection, and put in your username@cs.indstate.edu. You may need to quit VS Code and start it again, but you should see the connection listed. You can click the arrow icon to connect with the current window or click the window button to connect in a new window.

At this point when you Open, Save, etc. files, they will be on the CS server.

You can also start a terminal within VS Code by clicking Terminal in the menu at the top and then "New Terminal".

You can have a source code file open and then run the file from within the terminal.

If you want to close the remote connection you can click on the connection icon in the lower left of the window and choose to close the remote connection. Then you would be looking at files on your personal computer again.

If you have multiple accounts on the CS server, you can create multiple Remote Explorer entries. If you click the gear by SSH in the Remote Explorer pane, you can click to edit the configuration file to change how these are displayed. For example, this configuration file lists two accounts for Jeff Kinne.

Host jkinne@cs.indstate.edu
  HostName cs.indstate.edu
  User jkinne

Host cs51000@cs.indstate.edu
  HostName cs.indstate.edu
  User cs51000