EE485A Lecture 03-Vscode
EE485A Lecture 03-Vscode
3
Why not emacs? not vim? but vscode?
Fact: emacs and vim are also wonderful source code editors
FYI: I am using vim for writing my code
Better cross-platform
vim and emacs are mainly designed for *nix (Unix-like) platform
vscode focuses on cross-platform; that’s why they use JavaScript for their
extensions, which can be cross-platform
4
Installation
Go to https://code.visualstudio.com
5
Make your first file with vscode
1. Launch vscode
6
Make your first file with vscode
Status Bar
8
Visual Studio Code Interface
Activity Bar
9
Visual Studio Code Interface
Explorer view
10
Visual Studio Code Interface
Search view
11
Visual Studio Code Interface
12
Visual Studio Code Interface
Run view
13
Visual Studio Code Interface
Extensions view
14
Visual Studio Code Interface
[View] è [Command Palette]
e.g., Control+Shift+P in Windows
15
Keyboard shortcuts
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf
16
Keyboard shortcuts
Command Palette also shows shortcuts for you
17
Install Extensions
Go to Extension view
Recommended: C/C++
e.g., IntelliSense
18
Install Extensions
Recommended: Remote – SSH
Allows to create files in remote servers
We will explain it later
19
Remote-SSH: Connect to Host
After installing the extension, choose ‘Remote-SSH: Connect to Host…’
20
Create a file in remote server
Create a file similar to the local environment
If you connect to a server with ssh, you will see that your file is created
21
Avoid repeated password typing with SSH key
One tedious task: Repeatedly typing your password
How to avoid? Use SSH key (Windows)
1. Launch PowerShell
2. Create SSH Key with ssh-keygen without passphrase
22
Avoid repeated password typing with SSH key
3. Copy .ssh/id_rsa.pub to .ssh/authorized_keys in your remote server
4. Setup permissions
$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/authorized_keys
23
Compile, Run & Debug
Honestly speaking, there is a more powerful way to compile, run, and debug in
visual studio
If you are interested in, please check https://code.visualstudio.com/docs/cpp/config-linux
But, we recommend you to use separate terminals to compile, run & debug your
code.
Compile: gcc209 –o hello hello.c
Run: ./hello
Debug: gdb ./hello
24
Example: Setup assignment 2 with vscode
1. Download and extract assignment2.tar.gz to your local machine
# eelab5.kaist.ac.kr
$ mkdir assignment2
$ wget http://computer.kaist.ac.kr/EE209/assignments/assignment2/assignment2.tar.gz
$ tar –xvf assignment2.tar.gz
$ rm assignment2.tar.gz
25
Homework
Task: Setup SSH key and vscode, and connect to a remote server
Submit screenshot for SSH log
Should starts with “Running script…”
Your log should not contain “Showing password prompt”
Deadline: 10:25am on March 25 (next class)
Invalid!
Correct
26
27