OLD | NEW |
---|---|
1 # Use Visual Studio Code on Chromium code base | 1 # Visual Studio Code Dev |
2 | 2 |
3 Visual Studio Code is a free, lightweight and powerful code editor for Windows, | |
4 Mac and Linux, based on Electron/Chromium. It has built-in support for | |
5 JavaScript, TypeScript and Node.js and a rich extension ecosystem that adds | |
6 intellisense, debugging, syntax highlighting etc. for many languages (C++, | |
7 Python, Go). It works without too much setup. Get started | |
8 [here](https://code.visualstudio.com/docs). | |
9 | |
10 It is NOT a full-fledged IDE like Visual Studio. The two are completely | |
11 separate products. The only commonality with Visual Studio is that both are | |
12 from Microsoft. | |
13 | |
14 Here's what works well: | |
15 | |
16 * Editing code works well especially when you get used to the [keyboard | |
17 shortcuts](https://code.visualstudio.com/docs/customization/keybindings). | |
18 VS Code is very responsive and can handle even big code bases like Chromium. | |
19 * Git integration is a blast. Built-in side-by-side view, local commit and | |
20 even extensions for | |
21 [history](https://marketplace.visualstudio.com/items?itemName=donjayamanne.g ithistory) | |
22 and | |
23 [blame view](https://marketplace.visualstudio.com/items?itemName=ryu1kn.anno tator). | |
24 * [Debugging](https://code.visualstudio.com/Docs/editor/debugging) works | |
25 well, even though startup times can be fairly high (~40 seconds with | |
26 gdb on Linux, much lower on Windows). You can step through code, inspect | |
27 variables, view call stacks for multiple threads etc. | |
28 * Opening files and searching solution-wide works well now after having | |
29 problems in earlier versions. | |
30 * Building works well. Build tools are easy to integrate. Warnings and errors | |
31 are displayed on a separate page and you can click to jump to the | |
32 corresponding line of code. | |
33 | |
3 [TOC] | 34 [TOC] |
4 | 35 |
5 [Visual Studio Code](http://code.visualstudio.com/) | 36 ## Updating This Page |
6 ([Wikipedia](https://en.wikipedia.org/wiki/Visual_Studio_Code)) is a | 37 |
7 multi-platform code editor that is itself based on Electron which is based on | 38 Please keep this doc up-to-date. VS Code is still in active development and |
8 Chromium. Visual Studio Code has a growing community and base of installable | 39 subject to changes. This doc is checked into the Chromium git repo, so if you |
9 extensions and themes. It works without too much setup. | 40 make changes, read the [documentation |
10 | 41 guidelines](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/documenta tion_guidelines.md) |
11 ## Install extensions | 42 and [submit a change list](https://www.chromium.org/developers/contributing-code ). |
12 | 43 |
13 `F1` paste | 44 All file paths and commands have been tested on Linux. Windows and Mac might |
14 `ext install cpptools you-complete-me clang-format chromium-codesearch` | 45 require a slightly different setup (e.g. `Ctrl` -> `Cmd`). Please update this |
15 then enter. For more extensions: | 46 page accordingly. |
16 https://marketplace.visualstudio.com/search?target=vscode | 47 |
17 | 48 ## Setup |
18 Highly recommend you also install your favorite keymap. | 49 |
19 | 50 ### Installation |
20 An Example to install eclipse keymaps `ext install vscode-eclipse-keybindings`. | 51 |
21 You can search keymaps here. | 52 Follow the steps on https://code.visualstudio.com/docs/setup/setup-overview. To |
22 https://marketplace.visualstudio.com/search?target=vscode&category=Keymaps | 53 run it on Linux, just navigate to `chromium/src` folder and type `code .` in a |
23 | 54 terminal. The argument to `code` is the base directory of the workspace. VS |
24 | 55 Code does not require project or solution files. However, it does store |
25 ## Settings | 56 workspace settings in a `.vscode` folder in your base directory. |
26 | 57 |
27 Open Settings `File/Code - Preferences - Settings` and add the following | 58 ### Useful Extensions |
28 settings. | 59 |
29 | 60 Up to now, you have a basic version of VS Code without much language support. |
30 ``` | 61 Next, we will install some useful extensions. Jump to the extensions window |
31 { | 62 (`Ctrl+Shift+X`) and install these extensions, you will most likely use them |
32 "editor.tabSize": 2, | 63 every day: |
33 "editor.rulers": [80], | 64 |
34 "[cpp]": { | 65 * ***C/C++*** - |
35 "editor.quickSuggestions": true | 66 Intellisense, code formatting, debugging. |
36 }, | 67 * ***Python*** - |
37 // Exclude | 68 Linting, intellisense, code formatting, refactoring, debugging, snippets. |
38 "files.exclude": { | 69 * ***Toggle Header/Source*** - |
39 "**/.git": true, | 70 Toggles between .cc and .h with `F4`. The C/C++ extension supports this as |
40 "**/.svn": true, | 71 well through `Alt+O`. Last time I checked this was very laggy, but they |
41 "**/.hg": true, | 72 might have improved it since, so this extension might not be necessary. |
42 "**/.DS_Store": true, | 73 * ***Protobuf support*** - |
43 "**/out": true | 74 Syntax highlighting for .proto files. |
44 }, | 75 * ***you-complete-me*** - |
45 // YCM | 76 YouCompleteMe code completion for VS Code. It works fairly well in Chromium. |
46 "ycmd.path": "<your_ycmd_path>", | 77 * ***Rewrap*** - |
47 "ycmd.global_extra_config": | 78 Wrap lines at 80 characters with `Alt+Q`. |
48 "<your_chromium_path>/src/tools/vim/chromium.ycm_extra_conf.py", | 79 |
49 "ycmd.confirm_extra_conf": false, | 80 To install You-Complete-Me, enter these commands in a terminal: |
50 "ycmd.use_imprecise_get_type": true, | |
51 // clang-format | |
52 "clang-format.executable": "<your_depot_tools>/clang-format", | |
53 "clang-format.style": "file" | |
54 } | |
55 ``` | |
56 | |
57 ### Install auto-completion engine(ycmd) | |
58 | 81 |
59 ``` | 82 ``` |
60 $ git clone https://github.com/Valloric/ycmd.git ~/.ycmd | 83 $ git clone https://github.com/Valloric/ycmd.git ~/.ycmd |
61 $ cd ~/.ycmd | 84 $ cd ~/.ycmd |
62 $ ./build.py --clang-completer | 85 $ ./build.py --clang-completer |
63 ``` | 86 ``` |
64 | 87 |
65 ## Work flow | 88 The following extensions might be useful for you as well: |
66 | 89 |
67 1. `ctrl+p` open file. | 90 * ***Annotator*** - |
68 2. `ctrl+o` goto symbol. `ctrl+l` goto line. | 91 Git blame view. |
69 3. <code>ctrl+`</code> toggle terminal. | 92 * ***Git History (git log)*** - |
70 4. `F1` - `CodeSearchOpen` open current line in code search on chrome. | 93 Git history view. |
71 5. `F1` - `CodeSearchReferences` open XRef Infomation of current symbol. | 94 * ***chromium-codesearch*** - |
72 6. Use right click menu call `go to definition` or `peek definition`. | 95 Code search (CS) integration, see [Chromium Code |
73 7. Use right click menu call `find all references`. | 96 Search](https://cs.chromium.org/), in particular *open current line in CS*, |
74 | 97 *show references* and *go to definition*. Very useful for existing code. By |
75 ## Tips | 98 design, won't work for code not checked in yet. Overrides default C/C++ |
76 | 99 functionality. Had some issues last time I tried (extensions stopped |
77 ### On laptop | 100 working), so use with care. |
chaopeng
2017/04/12 03:19:56
I also found go to definition is annoying and usel
| |
78 | 101 * ***change-case*** - |
79 Because we use ycmd to enable auto completion. We can disable CPP autocomplete | 102 Quickly change the case of the current selection or current word. |
80 and index to save battery. We can also disable git status autorefresh to save | 103 * ***Instant Markdown*** - |
81 battery. | 104 Instant markdown (.md) preview in your browser as you type. This document |
105 was written with this extension! | |
106 * ***Clang-Format*** - | |
107 Format your code using clang-format. The C/C++ extension already supports | |
108 format-on-save (see `C_Cpp.clang_format_formatOnSave` setting). This | |
109 extension adds the ability to format a document or the current selection on | |
110 demand. | |
111 | |
112 Also be sure to take a look at the | |
113 [VS Code marketplace](https://marketplace.visualstudio.com/VSCode) to check out other | |
114 useful extensions. | |
115 | |
116 ### Color Scheme | |
117 Press `Ctrl+Shift+P, color, Enter` to pick a color scheme for the editor. There | |
118 are also tons of [color schemes available for download on the | |
119 marketplace](https://marketplace.visualstudio.com/search?target=VSCode&category= Themes&sortBy=Downloads). | |
120 | |
121 ### Usage Tips | |
122 * `Ctrl+P` opens a search box to find and open a file. | |
123 * `F1` or `Ctrl+Shift+P` opens a search box to find a command (e.g. Tasks: Run | |
124 Task). | |
125 * `Ctrl+K, Ctrl+S` opens the key bindings editor. | |
126 * ``Ctrl+` `` toggles the built-in terminal. | |
127 * `Ctrl+Shift+M` toggles the problems view (linter warnings, compile errors | |
128 and warnings). You'll swicth a lot between terminal and problem view during | |
129 compilation. | |
130 * `Alt+O` switches between the source/header file. | |
131 * `Ctrl+G` jumps to a line. | |
132 * `F12` jumps to the definition of the symbol at the cursor (also available on | |
133 right-click context menu). | |
134 * `Shift+F12` or `F1, CodeSearchReferences, Return` shows all references of | |
135 the symbol at the cursor. | |
136 * `F1, CodeSearchOpen, Return` opens the current file in Code Search. | |
137 * `Ctrl+D` selects the word at the cursor. Pressing it multiple times | |
138 multi-selects the next occurrences, so typing in one types in all of them, | |
139 and `Ctrl+U` deselects the last occurrence. | |
140 * `Ctrl+K, Z` enters Zen Mode, a fullscreen editing mode with nothing but the | |
141 current editor visible. | |
142 * `Ctrl+X` without anything selected cuts the current line. `Ctrl+V` pastes | |
143 the line. | |
144 | |
145 ## Setup For Chromium | |
146 | |
147 VS Code is configured via JSON files. This paragraph contains JSON configuration | |
148 files that are useful for Chromium development, in particular. See [VS Code | |
149 documentation](https://code.visualstudio.com/docs/customization/overview) for an | |
150 introduction to VS Code customization. | |
151 | |
152 ### Workspace Settings | |
153 Open the file chromium/src/.vscode/settings.json and add the following settings. | |
154 Remember to replace `<full_path_to_your_home>`! | |
155 | |
156 ``` | |
157 { | |
158 // Default tab size of 2. | |
159 "editor.tabSize": 2, | |
160 // Do not figure out tab size from opening a file. | |
161 "editor.detectIndentation": false, | |
162 // Add a line at 80 characters. | |
163 "editor.rulers": [80], | |
164 // Optional: Highlight current line at the left of the editor. | |
165 "editor.renderLineHighlight": "gutter", | |
166 // Optional: Don't automatically add closing brackets. It gets in the way. | |
167 "editor.autoClosingBrackets": false, | |
168 // Optional: Enable a tiny 30k feet view of your doc. | |
169 "editor.minimap.enabled": true, | |
170 "editor.minimap.maxColumn": 80, | |
171 "editor.minimap.renderCharacters": false, | |
172 // Trim tailing whitespace on save. | |
173 "files.trimTrailingWhitespace": true, | |
174 // Optional: Do not open files in 'preview' mode. Opening a new file in can | |
175 // replace an existing one in preview mode, which can be confusing. | |
176 "workbench.editor.enablePreview": false, | |
177 // Optional: Same for files opened from quick open (Ctrl+P). | |
178 "workbench.editor.enablePreviewFromQuickOpen": false, | |
179 | |
180 "files.associations": { | |
181 // Adds xml syntax highlighting for grd files. | |
182 "*.grd" : "xml", | |
183 // Optional: .gn and .gni are not JavaScript, but at least it gives some | |
184 // approximate syntax highlighting. Ignore the linter warnings! | |
185 "*.gni" : "javascript", | |
186 "*.gn" : "javascript" | |
187 }, | |
188 | |
189 "files.exclude": { | |
190 // Ignore build output folders. | |
191 "out*/**": true | |
192 }, | |
193 | |
194 // Wider author column for annotator extension. | |
195 "annotator.annotationColumnWidth": "24em", | |
196 | |
197 // C++ clang format settings. | |
198 "C_Cpp.clang_format_path": "<full_path_to_your_home>/depot_tools/clang-format" , | |
199 "C_Cpp.clang_format_sortIncludes": true, | |
200 "C_Cpp.clang_format_formatOnSave": true, | |
201 | |
202 // YouCompleteMe | |
203 "ycmd.path": "<full_path_to_your_home>/.vim/bundle/YouCompleteMe/third_party/y cmd", | |
204 "ycmd.global_extra_config": "<full_path_to_your_home>/chromium/src/tools/vim/. ycm_extra_conf.py", | |
205 "ycmd.confirm_extra_conf": false, | |
206 } | |
207 ``` | |
208 | |
209 ### Tasks | |
210 Next, we'll tell VS Code how to compile our code and how to read warnings and | |
211 errors from the build output. Copy the code below to | |
212 chromium/src/.vscode/tasks.json. This will provide 5 tasks to do basic things. | |
213 You might have to adjust the commands to your situation and needs. | |
214 | |
215 ``` | |
216 { | |
217 "version": "0.1.0", | |
218 "_runner": "terminal", | |
219 "showOutput": "always", | |
220 "echoCommand": true, | |
221 "tasks": [ | |
222 { | |
223 "taskName": "1-build_chrome_debug", | |
224 "command": "ninja -C out/Debug -j 2000 chrome", | |
225 "isShellCommand": true, | |
226 "isTestCommand": true, | |
227 "problemMatcher": { | |
228 "owner": "cpp", | |
229 "fileLocation": ["relative", "${workspaceRoot}"], | |
230 "pattern": { | |
231 "regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.* )$", | |
232 "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 | |
233 } | |
234 } | |
235 }, | |
236 { | |
237 "taskName": "2-build_chrome_release", | |
238 "command": "ninja -C out/Release -j 2000 chrome", | |
239 "isShellCommand": true, | |
240 "isBuildCommand": true, | |
241 "problemMatcher": { | |
242 "owner": "cpp", | |
243 "fileLocation": ["relative", "${workspaceRoot}"], | |
244 "pattern": { | |
245 "regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.* )$", | |
246 "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 | |
247 } | |
248 } | |
249 }, | |
250 { | |
251 "taskName": "3-build_all_debug", | |
252 "command": "ninja -C out/Debug -j 2000", | |
253 "isShellCommand": true, | |
254 "problemMatcher": { | |
255 "owner": "cpp", | |
256 "fileLocation": ["relative", "${workspaceRoot}"], | |
257 "pattern": { | |
258 "regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.* )$", | |
259 "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 | |
260 } | |
261 } | |
262 }, | |
263 { | |
264 "taskName": "4-build_all_release", | |
265 "command": "ninja -C out/Release -j 2000", | |
266 "isShellCommand": true, | |
267 "problemMatcher": { | |
268 "owner": "cpp", | |
269 "fileLocation": ["relative", "${workspaceRoot}"], | |
270 "pattern": { | |
271 "regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.* )$", | |
272 "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 | |
273 } | |
274 } | |
275 }, | |
276 { | |
277 "taskName": "5-build_test_debug", | |
278 "command": "ninja -C out/Debug -j 2000 unit_tests components_unittests brows er_tests", | |
279 "isShellCommand": true, | |
280 "problemMatcher": { | |
281 "owner": "cpp", | |
282 "fileLocation": ["relative", "${workspaceRoot}"], | |
283 "pattern": { | |
284 "regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.* )$", | |
285 "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 | |
286 } | |
287 } | |
288 }] | |
289 } | |
290 ``` | |
291 | |
292 ### Launch Commands | |
293 Launch commands are the equivalent of `F5` in Visual Studio: They launch some | |
294 program or a debugger. Optionally, they can run some task defined in | |
295 `tasks.json`. Launch commands can be run from the debug view (`Ctrl+Shift+D`). | |
296 Copy the code below to chromium/src/.vscode/launch.json and adjust them to | |
297 your situation and needs. | |
298 ``` | |
299 { | |
300 "version": "0.2.0", | |
301 "configurations": [ | |
302 { | |
303 "name": "Chrome Debug", | |
304 "type": "cppdbg", | |
305 "request": "launch", | |
306 "targetArchitecture": "x64", | |
307 "program": "${workspaceRoot}/out/Debug/chrome", | |
308 "args": [], // Optional command line args | |
309 "preLaunchTask": "1-build_chrome_debug", | |
310 "stopAtEntry": false, | |
311 "cwd": "${workspaceRoot}", | |
312 "environment": [], | |
313 "externalConsole": true | |
314 }, | |
315 { | |
316 "name": "Chrome Release", | |
317 "type": "cppdbg", | |
318 "request": "launch", | |
319 "targetArchitecture": "x64", | |
320 "program": "${workspaceRoot}/out/Release/chrome", | |
321 "args": [], // Optional command line args | |
322 "preLaunchTask": "2-build_chrome_release", | |
323 "stopAtEntry": false, | |
324 "cwd": "${workspaceRoot}", | |
325 "environment": [], | |
326 "externalConsole": true | |
327 }, | |
328 { | |
329 "name": "Custom Test Debug", | |
330 "type": "cppdbg", | |
331 "request": "launch", | |
332 "targetArchitecture": "x64", | |
333 "program": "${workspaceRoot}/out/Debug/unit_tests", | |
334 "args": ["--gtest_filter=*", | |
335 "--single_process", | |
336 "--ui-test-action-max-timeout=1000000", | |
337 "--test-launcher-timeout=1000000"], | |
338 "preLaunchTask": "5-build_test_debug", | |
339 "stopAtEntry": false, | |
340 "cwd": "${workspaceRoot}", | |
341 "environment": [], | |
342 "externalConsole": true | |
343 }, | |
344 { | |
345 "name": "Attach Debug", | |
346 "type": "cppdbg", | |
347 "request": "launch", | |
348 "targetArchitecture": "x64", | |
349 "program": "${workspaceRoot}/out/Debug/chrome", | |
350 "args": ["--remote-debugging-port=2224"], | |
351 "stopAtEntry": false, | |
352 "cwd": "${workspaceRoot}", | |
353 "environment": [], | |
354 "externalConsole": false | |
355 }] | |
356 } | |
357 ``` | |
358 | |
359 ### Key Bindings | |
360 To edit key bindings, press `Ctrl+K, Ctrl+S`. You'll see the defaults on the | |
361 left and your overrides on the right stored in the file `keybindings.json`. To | |
362 change a key binding, copy the corresponding key binding to the right. It's | |
363 fairly self-explanatory. | |
364 | |
365 You can bind any command to a key, even commands specified by extensions like | |
366 `CodeSearchOpen`. For instance, to bind `CodeSearchOpen` to `F2` to , simply add | |
367 `{ "key": "F2", "command": "cs.open" },`. | |
368 Note that the command title `CodeSearchOpen` won't work. You have to get the | |
369 actual command name from the [package.json | |
370 file](https://github.com/chaopeng/vscode-chromium-codesearch/blob/master/package .json) | |
371 of the extension. | |
372 | |
373 If you are used to other editors, you can also install your favorite keymap. | |
374 For instance, to install eclipse keymaps, install the | |
375 `vscode-eclipse-keybindings` extension. More keymaps can be found | |
376 [in the marketplace](https://marketplace.visualstudio.com/search?target=vscode&c ategory=Keymaps). | |
377 | |
378 Here are some key bindings that are likely to be useful for you: | |
379 | |
380 ``` | |
381 // Place your key bindings in this file to overwrite the defaults | |
382 [ | |
383 // Run the task marked as "isTestCommand": true, see tasks.json. | |
384 { "key": "ctrl+shift+t", "command": "workbench.action.tasks.test" }, | |
385 // Jump to the previous change in the built-in diff tool. | |
386 { "key": "ctrl+up", "command": "workbench.action.compareEditor.previo usChange" }, | |
387 // Jump to the next change in the built-in diff tool. | |
388 { "key": "ctrl+down", "command": "workbench.action.compareEditor.nextCh ange" }, | |
389 // Jump to previous location in the editor (useful to get back from viewing a sy mbol definition). | |
390 { "key": "alt+left", "command": "workbench.action.navigateBack" }, | |
391 // Jump to next location in the editor. | |
392 { "key": "alt+right", "command": "workbench.action.navigateForward" }, | |
393 // Get a blame view of the current file. Requires the annotator extension. | |
394 { "key": "ctrl+alt+a", "command": "annotator.annotate" }, | |
395 // Toggle header/source with the Toggle Header/Source extension (overrides the | |
396 // key binding from the C/C++ extension as I found it to be slow). | |
397 { "key": "alt+o", "command": "togglehs.toggleHS" }, | |
398 // Quickly run a task, see tasks.json. Since we named them 1-, 2- etc., it is | |
399 // suffucient to press the corresponding number. | |
400 { "key": "ctrl+r", "command": "workbench.action.tasks.runTask", | |
401 "when": "!inDebugMode" }, | |
402 // The following keybindings are useful on laptops with small keyboards such as | |
403 // Chromebooks that don't provide all keys. | |
404 { "key": "shift+alt+down", "command": "cursorColumnSelectDown", | |
405 "when": "editorTextFocus" }, | |
406 { "key": "shift+alt+left", "command": "cursorColumnSelectLeft", | |
407 "when": "editorTextFocus" }, | |
408 { "key": "shift+alt+pagedown", "command": "cursorColumnSelectPageDown", | |
409 "when": "editorTextFocus" }, | |
410 { "key": "shift+alt+pageup", "command": "cursorColumnSelectPageUp", | |
411 "when": "editorTextFocus" }, | |
412 { "key": "shift+alt+right", "command": "cursorColumnSelectRight", | |
413 "when": "editorTextFocus" }, | |
414 { "key": "shift+alt+up", "command": "cursorColumnSelectUp", | |
415 "when": "editorTextFocus" }, | |
416 { "key": "alt+down", "command": "scrollPageDown", | |
417 "when": "editorTextFocus" }, | |
418 { "key": "alt+up", "command": "scrollPageUp", | |
419 "when": "editorTextFocus" }, | |
420 { "key": "alt+backspace", "command": "deleteRight", | |
421 "when": "editorTextFocus && !editorReadonly" } , | |
422 { "key": "ctrl+right", "command": "cursorEnd", | |
423 "when": "editorTextFocus" }, | |
424 { "key": "ctrl+shift+right", "command": "cursorEndSelect", | |
425 "when": "editorTextFocus" }, | |
426 { "key": "ctrl+left", "command": "cursorHome", | |
427 "when": "editorTextFocus" }, | |
428 { "key": "ctrl+shift+left", "command": "cursorHomeSelect", | |
429 "when": "editorTextFocus" }, | |
430 ] | |
431 ``` | |
432 | |
433 ### Tips | |
434 | |
435 #### The `out` folder | |
436 Automatically generated code is put into a subfolder of out/, which means that | |
437 these files are ignored by VS Code (see files.exclude above) and cannot be | |
438 opened e.g. from quick-open (`Ctrl+P`). On Linux, you can create a symlink as a | |
439 work-around: | |
440 ``` | |
441 cd ~/chromium/src | |
442 mkdir _out | |
443 ln -s ../out/Debug/gen _out/gen | |
444 ``` | |
445 We picked _out since it is already in .gitignore, so it won't show up in git | |
446 status. | |
447 | |
448 Note: As of version 1.9, VS Code does not support negated glob commands, but | |
449 once it does, you can use | |
450 ``` | |
451 "!out/Debug/gen/**": true | |
452 ``` | |
453 in files.exclude instead of the symlink. | |
454 | |
455 #### Using VS Code as git editor | |
456 Add `[core] editor = "code --wait"` to your `~/.gitconfig` file in order to use | |
457 VS Code as editor for git commit messages etc. Note that the editor starts up | |
458 significantly slower than nano or vim. To use VS Code as merge tool, add | |
459 `[merge] tool = code`. | |
460 | |
461 #### Task Names | |
462 Note that we named the tasks `1-build_chrome_debug`, `2-build_chrome_release` | |
463 etc. This allows you to quickly execute tasks by pressing their number: | |
464 Press `Ctrl+P` and enter `task <n>`, where `<n>` is the number of the task. You | |
465 can also create a keyboard shortcut for running a task. `File > Preferences > | |
466 Keyboard Shortcuts` and add `{ "key": "ctrl+r", "command": | |
467 "workbench.action.tasks.runTask", "when": "!inDebugMode" }`. Then it's | |
468 sufficient to press `Ctrl+R` and enter `<n>`. | |
469 | |
470 #### Working on Laptop | |
471 Because autocomplete is provided by the You-Complete-Me extension, consider | |
472 disabling C/C++ autocomplete and indexing to save battery. In addition, you | |
473 might want to disable git status autorefresh as well. | |
82 | 474 |
83 ``` | 475 ``` |
84 "git.autorefresh": false, | 476 "git.autorefresh": false, |
85 "C_Cpp.autocomplete": "Disabled", | 477 "C_Cpp.autocomplete": "Disabled", |
86 "C_Cpp.addWorkspaceRootToIncludePath": false | 478 "C_Cpp.addWorkspaceRootToIncludePath": false |
87 ``` | 479 ``` |
88 | 480 |
89 ### Enable Sublime-like minimap | |
90 | |
91 ``` | |
92 "editor.minimap.enabled": true, | |
93 "editor.minimap.renderCharacters": false | |
94 ``` | |
95 | |
96 ### More | 481 ### More |
97 | 482 More tips and tricks can be found |
98 https://github.com/Microsoft/vscode-tips-and-tricks/blob/master/README.md | 483 [here](https://github.com/Microsoft/vscode-tips-and-tricks/blob/master/README.md ). |
OLD | NEW |