Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 60ebb35

Browse files
committed
Updated VSCode tips
1 parent 2f1d01e commit 60ebb35

File tree

6 files changed

+38
-50
lines changed

6 files changed

+38
-50
lines changed

VSCodeTips/README.md

Lines changed: 36 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
# VSCode Tips
22

3+
Although you are free to make you own choice of text/code editor to use during class and homework, we have good experiences with Microsoft's free Visual Studio Code (VSCode) editor.
4+
5+
From the [VSCode web site](https://code.visualstudio.com/):
6+
7+
> Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as .NET and Unity).
8+
39
Here are some tips for getting up to speed with VSCode as you progress through this course.
410

11+
## Installation
12+
13+
Download and install the appropriate version of VSCode for your operating system from the [VSCode web site](https://code.visualstudio.com/).
14+
515
## Some useful extensions
616

717
VSCode can be extended with _extensions_. There are two that we recommend you install from day 1.
@@ -21,10 +31,8 @@ VSCode can be extended with _extensions_. There are two that we recommend you in
2131

2232
![Figure 1. Spell checker extension](assets/27807986-f1f76762-6044-11e7-831d-dd2a6551f027.PNG)
2333

24-
(The indication 122K in this picture means that this extension has been downloaded 122,000 times. The five star rating indicates users like it a lot.)
25-
2634
4. Press the green `install` button of **Code Spellchecker**.
27-
5. When the installation has finished, install the ESLint extension in a similar fashion (1.2 million downloads!):
35+
5. When the installation has finished, install the ESLint extension in a similar fashion:
2836

2937
![Figure 2. ESLint extension](assets/27807987-f1fa8406-6044-11e7-8284-b51cd1251921.PNG)
3038

@@ -39,6 +47,26 @@ VSCode can be extended with _extensions_. There are two that we recommend you in
3947

4048
9. Once the installation has finished close VSCode for now.
4149

50+
## Customise VSCode Settings
51+
52+
We recommend that you apply two changes to the default settings of VSCode to help you create well-formatted JavaScript code. Follow these steps:
53+
54+
1. Press the cog-wheel icon in the lower-left corner of the VSCode screen, as indicated here:
55+
56+
![settings-btn](assets/settings.png)
57+
58+
2. From the menu, select **Settings**.
59+
3. In the `USER SETTINGS` tab in the right-hand half of the screen add the two lines indicated below between the curly braces:
60+
```json
61+
/// Place your settings in this file to overwrite the default settings
62+
{
63+
"editor.formatOnType": true,
64+
"editor.formatOnPaste": true
65+
}
66+
```
67+
68+
4. Close the User Settings tab.
69+
4270
## Using VSCode for your homework
4371

4472
You’ll get the most out of VSCode if you organise your work in folders, say a folder for each week in the JavaScript module.
@@ -107,55 +135,15 @@ Here are some short-cut commands that you will use many times a day and that we
107135

108136
## Running and debugging your code with the VSCode Node debugger
109137

110-
If your JavaScript program is contained in a single file the easiest way to run and examine your code is the start straight in VSCode. Before you can run it you need to do a small preparation. This needs to be done only once per project folder.
111-
112-
1. As illustrated in the figure below, press the **Debug** button in the left margin as indicated by the red triangle.
113-
114-
![debug_1](assets/27833250-393c5a82-60d2-11e7-8713-648ec54abbed.png)
115-
116-
2. You'll see the Debugger Pane in the left hand side of the screen as shown below. Press the "cog" button as indicated by the red triangle.
117-
118-
![debug_2](assets/27833256-3d44da32-60d2-11e7-8f34-0bc0579a10c3.png)
119-
120-
3. Next you will prompted to select an environment. Choose `Node.js`. This produces a JSON file, displayed in a new editor tab with a contents as shown below.
121-
122-
```
123-
{
124-
// Use IntelliSense to learn about possible Node.js debug attributes.
125-
// Hover to view descriptions of existing attributes.
126-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
127-
"version": "0.2.0",
128-
"configurations": [
129-
{
130-
"type": "node",
131-
"request": "launch",
132-
"name": "Launch Program",
133-
"program": "${file}"
134-
}
135-
]
136-
}
137-
```
138-
139-
At this his time no changes are necessary to this file. You can just close the editor tab.
140-
141-
4. Next, press the **Explorer** button in the left margin as indicated by the red triangle in the figure below.
142-
143-
![debug_3](assets/27833921-189a16f4-60d5-11e7-87ee-996cf97921ac.png)
144-
145-
5. Observe that VSCode has created a `.vscode` subfolder in your project folder where it keeps the JSON file just created and potentially other VSCode settings.
146-
6. You can now run your code in the debugger. Switch to the editor tab contains your program and press the green triangular button or, alternatively, press F5.
147-
7. Note that when your program finishes execution the debugger is still active. You can stop it by pressing the square red button.
148-
149-
If you do not really need to debug your program (e.g., by placing breakpoints) etc, you may prefer to run your program in a terminal window. You can open an Integrated Terminal as explained earlier and type:
138+
If your JavaScript program is contained in a single file the easiest way to run and examine your code is the start straight in VSCode.
150139

151-
```
152-
node prog.js
153-
```
140+
1. Press the F5 function key to start the VSCode debugger.
154141

155-
Replace `prog.js` with the actual file name of your program.
142+
2. You will prompted to select an environment. Choose `Node.js` as show below.
156143

157-
If you want to run your program in terminal window independent of VSCode you should make sure you are in the same directory as the program you want to run.
144+
![debug_3](assets/debug-3.png)
158145

146+
This starts your program in the VSCode debugger.
159147

160148
### Placing break points and inspecting variables
161149

VSCodeTips/assets/debug-1.png

51.1 KB
Loading

VSCodeTips/assets/debug-2.png

48 KB
Loading

VSCodeTips/assets/debug-3.png

13.1 KB
Loading

VSCodeTips/assets/settings.png

3.32 KB
Loading

Week2/REVIEW.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This review covers:
55
•• Intro JavaScript (What is it, where can you use it for)
66
• Variables [var, let, const]
77
• Basic value types [Strings, Numbers, Arrays, Booleans]
8-
• Operators
8+
• Operators
99
• Naming conventions
1010
```
1111

@@ -36,4 +36,4 @@ Values are the "things" that you assign to a variable. All values have a type. I
3636

3737
In programming you will need to come up with appropriate names for your variables and functions.
3838

39-
[Read more...](../fundamentals/naming_convensions.md)
39+
[Read more...](../fundamentals/naming_conventions.md)

0 commit comments

Comments
 (0)