Skip to content

Commit 5c501b8

Browse files
committed
VS Code Config
1 parent f247e80 commit 5c501b8

2 files changed

Lines changed: 141 additions & 2 deletions

File tree

docs/images/command-pallette.png

90.3 KB
Loading

docs/prereqs/vs-code-text-editor.qmd

Lines changed: 141 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,149 @@ There are many text editor options out there, and it seems each developer has th
1010

1111
Our preferred text editor is called Visual Studio Code, or \"VS Code\" for short.
1212

13-
### Installation and Configuration
13+
### Installation
1414

1515
Unless you already have a text editor of choice, install [VS Code](https://code.visualstudio.com/).
1616

1717
### Success Criteria
1818

19-
You should be able to open the VS Code application.
19+
Once installed, you should be able to open the VS Code application.
20+
21+
This should be sufficient to get started, however if you are interested in optionally exploring some advanced tips and configuration settings, take a look at the sections below.
22+
23+
<hr>
24+
25+
### Tips and Tricks (Optional)
26+
27+
These are some of the author's tips and tricks, for your reference. Feel free but not obligated to use them.
28+
29+
#### Command Pallette
30+
31+
The [Command Pallette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) is by far one of the most powerful menu options in VS Code. You can open the Command Pallette with the keyboard shortcut "Command + Shift + P". Once opened, you can type commands to execute certain helpful actions in the text editor.
32+
33+
![The Command Pallette in VS Code.](../images/command-pallette.png)
34+
35+
#### Vertical Column Selection
36+
37+
Vertical column selection allows us to edit multiple lines simultaneously. This can be helpful if you have to change multiple lines of text at the same time, for example commenting-out many lines at once.
38+
39+
To perform a vertical column selection:
40+
41+
1. Click the cursor on the first line where we want to start the selection (where we would type our first comment character)
42+
2. Then press and hold “shift + option” on Mac, or “shift + alt” on Windows.
43+
3. Then click and drag straight down, and release the keys you were holding.
44+
4. Finally type a comment character (or whatever text you’d like), and notice it will be typed onto all the selected lines.
45+
46+
47+
![Demonstration of vertical column selection for editing many lines at once.](https://user-images.githubusercontent.com/1328807/50870478-2e9b8400-1386-11e9-9378-0afadc4a7dce.gif)
48+
49+
<!--
50+
![Demonstration of vertical column selection for commenting many lines at once.](https://prof-rossetti.github.io/intro-software-dev-python-book/images/vertical-column-select.gif)
51+
-->
52+
53+
This can definitely take some practice to get right, so feel free to reach out to an instructor for help.
54+
55+
#### Shell Commands
56+
57+
:::{.callout-note}
58+
Shell commands are only relevant for individuals who use the command line. Beginners who aren't using the command line, or who are unfamiliar with the command line, should skip this section.
59+
:::
60+
61+
Shell commands will allow us to open a VS Code window from the command line.
62+
63+
Shell commands are enabled by default on Windows. To enable shell commands on Mac, follow [these steps](https://code.visualstudio.com/docs/setup/mac#_launch-vs-code-from-the-command-line).
64+
65+
After enabling shell commands, you should be able to use the `code` command from the Terminal, to open files and folders at a specific filepath:
66+
67+
```sh
68+
# open all files and folders in the current working directory:
69+
code .
70+
71+
# open all files and folders in the specified directory, e.g. "path/to/my-project":
72+
code path/to/my-project
73+
```
74+
75+
<hr>
76+
77+
### Configurations (Optional)
78+
79+
These are some of the author's personal VS Code configurations, for your reference. Feel free but not obligated to use them.
80+
81+
#### Recommended Extensions
82+
83+
The extensions menu can be used to search and manage third party plugins that provide helpful capabilities. To view the extensions menu, use the top menu bar ("View" > "Extensions"), or use the keyboard shortcut "command + shift + X".
84+
85+
Here is a sample of the author's installed VS Code extensions that are language-agnostic and helpful for working on any type of coding project:
86+
87+
Extension Identifier | Description / Purpose
88+
--- | ---
89+
`whizkydee.material-palenight-theme` | An elegant and juicy color theme for Visual Studio Code.
90+
`xamm.filepath` | Shows the filepath of the current file in the editor and enables the user to click on the path to open the explorer in this location.
91+
`sleistner.vscode-fileutils` | A convenient way of creating, duplicating, moving, renaming and deleting files and directories.
92+
`streetsidesoftware.code-spell-checker` | A basic spell checker that works well with code and documents.
93+
`yzhang.markdown-all-in-one` | All you need to write Markdown (keyboard shortcuts, table of contents, auto preview and more).
94+
95+
Additionally, language-specific extensions can be installed to facilitate intelligent autocompletion of code, to save you time when developing.
96+
97+
98+
#### Recommended User Settings
99+
100+
Use the command palette and start typing "settings" to find the "Preferences > Open Settings (JSON)" setting which should yield a snippets JSON file.
101+
102+
Feel free to optionally update yours to include any of these settings overrides:
103+
104+
```json
105+
{
106+
"workbench.colorTheme": "Palenight Theme",
107+
"editor.fontSize": 14,
108+
"editor.tabSize": 4,
109+
"files.trimTrailingWhitespace": true,
110+
"files.insertFinalNewline": true,
111+
"files.trimFinalNewlines": true,
112+
"telemetry.telemetryLevel": "off",
113+
}
114+
```
115+
116+
FYI: the `files` related settings help clean files in a standard way upon saving them, and are especially helpful for developers working in teams.
117+
118+
119+
120+
#### Recommended Keyboard Shortcuts
121+
122+
Use the command palette and start typing "shortcuts" to find the "Preferences > Open Keyboard Shortcuts (JSON)" setting which should yield a snippets JSON file.
123+
124+
Feel free to optionally update yours to include any of these keyboard shortcut overrides:
125+
126+
```json
127+
[
128+
{
129+
"key": "cmd+\\",
130+
"command": "workbench.action.toggleSidebarVisibility"
131+
},
132+
{
133+
"key": "cmd+b",
134+
"command": "-workbench.action.toggleSidebarVisibility"
135+
},
136+
{
137+
"key": "shift+cmd+d",
138+
"command": "editor.action.duplicateSelection"
139+
},
140+
{
141+
"key": "cmd+t",
142+
"command": "workbench.action.quickOpen"
143+
},
144+
{
145+
"key": "ctrl+shift+m",
146+
"command": "markdown-preview-enhanced.openPreview",
147+
"when": "editorLangId == 'markdown'"
148+
},
149+
]
150+
151+
```
152+
153+
After enabling these shortcuts:
154+
155+
+ the "Command + \\" shortcut can now be used to toggle visibility of the left sidebar
156+
+ the "Shift + Command + D" shortcut can be used to duplicate a line of code, without copying it (this is handy when you have other content in the clipboard ready to be pasted)
157+
+ the "Command + T" shortcut can now be used to easily search for files by their name
158+
+ the "Control + Shift + M" shortcut, when a markdown file is open, will preview the contents of that markdown file in a new tab

0 commit comments

Comments
 (0)