blob: d78d198b726086e6280390dee969083938af483f [file] [log] [blame] [view]
ljustene262c842017-04-12 08:29:041# Visual Studio Code Dev
2
3Visual Studio Code is a free, lightweight and powerful code editor for Windows,
4Mac and Linux, based on Electron/Chromium. It has built-in support for
5JavaScript, TypeScript and Node.js and a rich extension ecosystem that adds
6intellisense, debugging, syntax highlighting etc. for many languages (C++,
7Python, Go). It works without too much setup. Get started
8[here](https://code.visualstudio.com/docs).
9
10It is NOT a full-fledged IDE like Visual Studio. The two are completely
11separate products. The only commonality with Visual Studio is that both are
12from Microsoft.
13
14Here'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.githistory)
22 and
23 [blame view](https://marketplace.visualstudio.com/items?itemName=ryu1kn.annotator).
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.
chaopengba312ce2017-02-12 03:38:2533
chaopengca285112017-03-02 15:39:0434[TOC]
35
ljustene262c842017-04-12 08:29:0436## Updating This Page
chaopengba312ce2017-02-12 03:38:2537
ljustene262c842017-04-12 08:29:0438Please keep this doc up-to-date. VS Code is still in active development and
39subject to changes. This doc is checked into the Chromium git repo, so if you
40make changes, read the [documentation
James Cook9d7e2192017-06-19 19:59:0941guidelines](https://chromium.googlesource.com/chromium/src/+/master/docs/documentation_guidelines.md)
ljustene262c842017-04-12 08:29:0442and [submit a change list](https://www.chromium.org/developers/contributing-code).
chaopengba312ce2017-02-12 03:38:2543
ljustene262c842017-04-12 08:29:0444All file paths and commands have been tested on Linux. Windows and Mac might
45require a slightly different setup (e.g. `Ctrl` -> `Cmd`). Please update this
46page accordingly.
chaopengba312ce2017-02-12 03:38:2547
ljustene262c842017-04-12 08:29:0448## Setup
chaopengba312ce2017-02-12 03:38:2549
ljustene262c842017-04-12 08:29:0450### Installation
chaopengba312ce2017-02-12 03:38:2551
ljustene262c842017-04-12 08:29:0452Follow the steps on https://code.visualstudio.com/docs/setup/setup-overview. To
53run it on Linux, just navigate to `chromium/src` folder and type `code .` in a
54terminal. The argument to `code` is the base directory of the workspace. VS
55Code does not require project or solution files. However, it does store
56workspace settings in a `.vscode` folder in your base directory.
chaopengba312ce2017-02-12 03:38:2557
ljustene262c842017-04-12 08:29:0458### Useful Extensions
chaopengba312ce2017-02-12 03:38:2559
ljustene262c842017-04-12 08:29:0460Up to now, you have a basic version of VS Code without much language support.
61Next, we will install some useful extensions. Jump to the extensions window
62(`Ctrl+Shift+X`) and install these extensions, you will most likely use them
63every day:
chaopengba312ce2017-02-12 03:38:2564
ljustene262c842017-04-12 08:29:0465* ***C/C++*** -
James Cook9d7e2192017-06-19 19:59:0966 Code formatting, debugging, Intellisense.
ljustene262c842017-04-12 08:29:0467* ***Python*** -
68 Linting, intellisense, code formatting, refactoring, debugging, snippets.
James Cook9f7c73d2017-06-20 15:06:1969* ***Toggle Header/Source*** -
70 Toggles between .cc and .h with `F4`. The C/C++ extension supports this as
71 well through `Alt+O` but sometimes chooses the wrong file when there are
72 multiple files in the workspace that have the same name.
ljustene262c842017-04-12 08:29:0473* ***Protobuf support*** -
74 Syntax highlighting for .proto files.
75* ***you-complete-me*** -
76 YouCompleteMe code completion for VS Code. It works fairly well in Chromium.
77* ***Rewrap*** -
78 Wrap lines at 80 characters with `Alt+Q`.
chaopengba312ce2017-02-12 03:38:2579
ljustene262c842017-04-12 08:29:0480To install You-Complete-Me, enter these commands in a terminal:
chaopengba312ce2017-02-12 03:38:2581
82```
83$ git clone https://github.com/Valloric/ycmd.git ~/.ycmd
84$ cd ~/.ycmd
sangwoo.ko5fe74c732017-09-01 14:44:5685$ git submodule update --init --recursive
chaopengba312ce2017-02-12 03:38:2586$ ./build.py --clang-completer
87```
James Cookcb868402017-06-23 16:04:2988If it fails with "Your C++ compiler does NOT fully support C++11." but you know
89you have a good compiler, hack cpp/CMakeLists.txt to set CPP11_AVAILABLE true.
chaopengba312ce2017-02-12 03:38:2590
ljustene262c842017-04-12 08:29:0491The following extensions might be useful for you as well:
chaopengba312ce2017-02-12 03:38:2592
ljustene262c842017-04-12 08:29:0493* ***Annotator*** -
94 Git blame view.
95* ***Git History (git log)*** -
96 Git history view.
97* ***chromium-codesearch*** -
98 Code search (CS) integration, see [Chromium Code
99 Search](https://cs.chromium.org/), in particular *open current line in CS*,
100 *show references* and *go to definition*. Very useful for existing code. By
101 design, won't work for code not checked in yet. Overrides default C/C++
102 functionality. Had some issues last time I tried (extensions stopped
103 working), so use with care.
104* ***change-case*** -
105 Quickly change the case of the current selection or current word.
106* ***Instant Markdown*** -
107 Instant markdown (.md) preview in your browser as you type. This document
108 was written with this extension!
109* ***Clang-Format*** -
110 Format your code using clang-format. The C/C++ extension already supports
111 format-on-save (see `C_Cpp.clang_format_formatOnSave` setting). This
112 extension adds the ability to format a document or the current selection on
113 demand.
chaopengba312ce2017-02-12 03:38:25114
ljustene262c842017-04-12 08:29:04115Also be sure to take a look at the
116[VS Code marketplace](https://marketplace.visualstudio.com/VSCode) to check out other
117useful extensions.
chaopengba312ce2017-02-12 03:38:25118
ljustene262c842017-04-12 08:29:04119### Color Scheme
120Press `Ctrl+Shift+P, color, Enter` to pick a color scheme for the editor. There
121are also tons of [color schemes available for download on the
122marketplace](https://marketplace.visualstudio.com/search?target=VSCode&category=Themes&sortBy=Downloads).
chaopengba312ce2017-02-12 03:38:25123
ljustene262c842017-04-12 08:29:04124### Usage Tips
125* `Ctrl+P` opens a search box to find and open a file.
126* `F1` or `Ctrl+Shift+P` opens a search box to find a command (e.g. Tasks: Run
127 Task).
128* `Ctrl+K, Ctrl+S` opens the key bindings editor.
129* ``Ctrl+` `` toggles the built-in terminal.
130* `Ctrl+Shift+M` toggles the problems view (linter warnings, compile errors
131 and warnings). You'll swicth a lot between terminal and problem view during
132 compilation.
133* `Alt+O` switches between the source/header file.
134* `Ctrl+G` jumps to a line.
135* `F12` jumps to the definition of the symbol at the cursor (also available on
136 right-click context menu).
137* `Shift+F12` or `F1, CodeSearchReferences, Return` shows all references of
138 the symbol at the cursor.
139* `F1, CodeSearchOpen, Return` opens the current file in Code Search.
140* `Ctrl+D` selects the word at the cursor. Pressing it multiple times
141 multi-selects the next occurrences, so typing in one types in all of them,
142 and `Ctrl+U` deselects the last occurrence.
143* `Ctrl+K, Z` enters Zen Mode, a fullscreen editing mode with nothing but the
144 current editor visible.
145* `Ctrl+X` without anything selected cuts the current line. `Ctrl+V` pastes
146 the line.
147
148## Setup For Chromium
149
150VS Code is configured via JSON files. This paragraph contains JSON configuration
151files that are useful for Chromium development, in particular. See [VS Code
152documentation](https://code.visualstudio.com/docs/customization/overview) for an
153introduction to VS Code customization.
154
155### Workspace Settings
156Open the file chromium/src/.vscode/settings.json and add the following settings.
157Remember to replace `<full_path_to_your_home>`!
158
159```
160{
161 // Default tab size of 2.
162 "editor.tabSize": 2,
163 // Do not figure out tab size from opening a file.
164 "editor.detectIndentation": false,
165 // Add a line at 80 characters.
166 "editor.rulers": [80],
167 // Optional: Highlight current line at the left of the editor.
168 "editor.renderLineHighlight": "gutter",
169 // Optional: Don't automatically add closing brackets. It gets in the way.
170 "editor.autoClosingBrackets": false,
171 // Optional: Enable a tiny 30k feet view of your doc.
172 "editor.minimap.enabled": true,
173 "editor.minimap.maxColumn": 80,
174 "editor.minimap.renderCharacters": false,
175 // Trim tailing whitespace on save.
176 "files.trimTrailingWhitespace": true,
177 // Optional: Do not open files in 'preview' mode. Opening a new file in can
178 // replace an existing one in preview mode, which can be confusing.
179 "workbench.editor.enablePreview": false,
180 // Optional: Same for files opened from quick open (Ctrl+P).
181 "workbench.editor.enablePreviewFromQuickOpen": false,
James Cook9d7e2192017-06-19 19:59:09182 // Optional: Don't continuously fetch remote changes.
183 "git.autofetch": false,
ljustene262c842017-04-12 08:29:04184
185 "files.associations": {
186 // Adds xml syntax highlighting for grd files.
187 "*.grd" : "xml",
188 // Optional: .gn and .gni are not JavaScript, but at least it gives some
189 // approximate syntax highlighting. Ignore the linter warnings!
190 "*.gni" : "javascript",
191 "*.gn" : "javascript"
192 },
193
194 "files.exclude": {
195 // Ignore build output folders.
196 "out*/**": true
197 },
198
dullwebera347f0eb2017-04-27 14:20:32199 "files.watcherExclude": {
dullweber48be1582017-04-28 09:40:25200 // Don't watch out*/ and third_party/ for changes to fix an issue
dullwebera347f0eb2017-04-27 14:20:32201 // where vscode doesn't notice that files have changed.
202 // https://github.com/Microsoft/vscode/issues/3998
dullweber48be1582017-04-28 09:40:25203 // There is currently another issue that requires a leading **/ for
204 // watcherExlude. Beware that this pattern might affect other out* folders
205 // like src/cc/output/.
206 "**/out*/**": true,
dullwebera347f0eb2017-04-27 14:20:32207 "**/third_party/**": true
208 },
209
ljustene262c842017-04-12 08:29:04210 // Wider author column for annotator extension.
211 "annotator.annotationColumnWidth": "24em",
212
213 // C++ clang format settings.
James Cook9d7e2192017-06-19 19:59:09214 "C_Cpp.clang_format_path": "${workspaceRoot}/third_party/depot_tools/clang-format",
ljustene262c842017-04-12 08:29:04215 "C_Cpp.clang_format_sortIncludes": true,
216 "C_Cpp.clang_format_formatOnSave": true,
217
218 // YouCompleteMe
James Cookcb868402017-06-23 16:04:29219 "ycmd.path": "<full_path_to_your_home>/.ycmd",
220 "ycmd.global_extra_config": "${workspaceRoot}/tools/vim/chromium.ycm_extra_conf.py",
ljustene262c842017-04-12 08:29:04221 "ycmd.confirm_extra_conf": false,
222}
223```
224
225### Tasks
226Next, we'll tell VS Code how to compile our code and how to read warnings and
227errors from the build output. Copy the code below to
228chromium/src/.vscode/tasks.json. This will provide 5 tasks to do basic things.
229You might have to adjust the commands to your situation and needs.
230
231```
232{
233 "version": "0.1.0",
234 "_runner": "terminal",
235 "showOutput": "always",
236 "echoCommand": true,
237 "tasks": [
238 {
239 "taskName": "1-build_chrome_debug",
240 "command": "ninja -C out/Debug -j 2000 chrome",
241 "isShellCommand": true,
242 "isTestCommand": true,
Lutz Justend4982792017-05-05 15:07:26243 "problemMatcher": [
244 {
ljustene262c842017-04-12 08:29:04245 "owner": "cpp",
246 "fileLocation": ["relative", "${workspaceRoot}"],
247 "pattern": {
248 "regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
249 "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
250 }
Lutz Justend4982792017-05-05 15:07:26251 },
252 {
253 "owner": "cpp",
254 "fileLocation": ["relative", "${workspaceRoot}"],
255 "pattern": {
256 "regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
257 "file": 1, "severity": 3, "message": 4
258 }
259 }]
ljustene262c842017-04-12 08:29:04260 },
261 {
262 "taskName": "2-build_chrome_release",
263 "command": "ninja -C out/Release -j 2000 chrome",
264 "isShellCommand": true,
265 "isBuildCommand": true,
Lutz Justend4982792017-05-05 15:07:26266 "problemMatcher": [
267 {
ljustene262c842017-04-12 08:29:04268 "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 }
Lutz Justend4982792017-05-05 15:07:26274 },
275 {
276 "owner": "cpp",
277 "fileLocation": ["relative", "${workspaceRoot}"],
278 "pattern": {
279 "regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
280 "file": 1, "severity": 3, "message": 4
281 }
282 }]
ljustene262c842017-04-12 08:29:04283 },
284 {
285 "taskName": "3-build_all_debug",
286 "command": "ninja -C out/Debug -j 2000",
287 "isShellCommand": true,
Lutz Justend4982792017-05-05 15:07:26288 "problemMatcher": [
289 {
ljustene262c842017-04-12 08:29:04290 "owner": "cpp",
291 "fileLocation": ["relative", "${workspaceRoot}"],
292 "pattern": {
293 "regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
294 "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
295 }
Lutz Justend4982792017-05-05 15:07:26296 },
297 {
298 "owner": "cpp",
299 "fileLocation": ["relative", "${workspaceRoot}"],
300 "pattern": {
301 "regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
302 "file": 1, "severity": 3, "message": 4
303 }
304 }]
ljustene262c842017-04-12 08:29:04305 },
306 {
307 "taskName": "4-build_all_release",
308 "command": "ninja -C out/Release -j 2000",
309 "isShellCommand": true,
Lutz Justend4982792017-05-05 15:07:26310 "problemMatcher": [
311 {
ljustene262c842017-04-12 08:29:04312 "owner": "cpp",
313 "fileLocation": ["relative", "${workspaceRoot}"],
314 "pattern": {
315 "regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
316 "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
317 }
Lutz Justend4982792017-05-05 15:07:26318 },
319 {
320 "owner": "cpp",
321 "fileLocation": ["relative", "${workspaceRoot}"],
322 "pattern": {
323 "regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
324 "file": 1, "severity": 3, "message": 4
325 }
326 }]
ljustene262c842017-04-12 08:29:04327 },
328 {
329 "taskName": "5-build_test_debug",
330 "command": "ninja -C out/Debug -j 2000 unit_tests components_unittests browser_tests",
331 "isShellCommand": true,
Lutz Justend4982792017-05-05 15:07:26332 "problemMatcher": [
333 {
ljustene262c842017-04-12 08:29:04334 "owner": "cpp",
335 "fileLocation": ["relative", "${workspaceRoot}"],
336 "pattern": {
337 "regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
338 "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
339 }
Lutz Justend4982792017-05-05 15:07:26340 },
341 {
342 "owner": "cpp",
343 "fileLocation": ["relative", "${workspaceRoot}"],
344 "pattern": {
345 "regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
346 "file": 1, "severity": 3, "message": 4
347 }
348 }]
ljustene262c842017-04-12 08:29:04349 }]
350}
351```
352
353### Launch Commands
354Launch commands are the equivalent of `F5` in Visual Studio: They launch some
355program or a debugger. Optionally, they can run some task defined in
356`tasks.json`. Launch commands can be run from the debug view (`Ctrl+Shift+D`).
357Copy the code below to chromium/src/.vscode/launch.json and adjust them to
358your situation and needs.
359```
360{
361 "version": "0.2.0",
362 "configurations": [
363 {
364 "name": "Chrome Debug",
365 "type": "cppdbg",
366 "request": "launch",
367 "targetArchitecture": "x64",
368 "program": "${workspaceRoot}/out/Debug/chrome",
369 "args": [], // Optional command line args
370 "preLaunchTask": "1-build_chrome_debug",
371 "stopAtEntry": false,
372 "cwd": "${workspaceRoot}",
373 "environment": [],
374 "externalConsole": true
375 },
376 {
377 "name": "Chrome Release",
378 "type": "cppdbg",
379 "request": "launch",
380 "targetArchitecture": "x64",
381 "program": "${workspaceRoot}/out/Release/chrome",
382 "args": [], // Optional command line args
383 "preLaunchTask": "2-build_chrome_release",
384 "stopAtEntry": false,
385 "cwd": "${workspaceRoot}",
386 "environment": [],
387 "externalConsole": true
388 },
389 {
390 "name": "Custom Test Debug",
391 "type": "cppdbg",
392 "request": "launch",
393 "targetArchitecture": "x64",
394 "program": "${workspaceRoot}/out/Debug/unit_tests",
395 "args": ["--gtest_filter=*",
396 "--single_process",
397 "--ui-test-action-max-timeout=1000000",
398 "--test-launcher-timeout=1000000"],
399 "preLaunchTask": "5-build_test_debug",
400 "stopAtEntry": false,
401 "cwd": "${workspaceRoot}",
402 "environment": [],
403 "externalConsole": true
404 },
405 {
406 "name": "Attach Debug",
407 "type": "cppdbg",
408 "request": "launch",
409 "targetArchitecture": "x64",
410 "program": "${workspaceRoot}/out/Debug/chrome",
411 "args": ["--remote-debugging-port=2224"],
412 "stopAtEntry": false,
413 "cwd": "${workspaceRoot}",
414 "environment": [],
415 "externalConsole": false
416 }]
417}
418```
419
420### Key Bindings
421To edit key bindings, press `Ctrl+K, Ctrl+S`. You'll see the defaults on the
422left and your overrides on the right stored in the file `keybindings.json`. To
423change a key binding, copy the corresponding key binding to the right. It's
424fairly self-explanatory.
425
426You can bind any command to a key, even commands specified by extensions like
427`CodeSearchOpen`. For instance, to bind `CodeSearchOpen` to `F2` to , simply add
428`{ "key": "F2", "command": "cs.open" },`.
429Note that the command title `CodeSearchOpen` won't work. You have to get the
430actual command name from the [package.json
431file](https://github.com/chaopeng/vscode-chromium-codesearch/blob/master/package.json)
432of the extension.
433
434If you are used to other editors, you can also install your favorite keymap.
435For instance, to install eclipse keymaps, install the
436`vscode-eclipse-keybindings` extension. More keymaps can be found
437[in the marketplace](https://marketplace.visualstudio.com/search?target=vscode&category=Keymaps).
438
439Here are some key bindings that are likely to be useful for you:
440
441```
442// Place your key bindings in this file to overwrite the defaults
443[
444// Run the task marked as "isTestCommand": true, see tasks.json.
445{ "key": "ctrl+shift+t", "command": "workbench.action.tasks.test" },
446// Jump to the previous change in the built-in diff tool.
447{ "key": "ctrl+up", "command": "workbench.action.compareEditor.previousChange" },
448// Jump to the next change in the built-in diff tool.
449{ "key": "ctrl+down", "command": "workbench.action.compareEditor.nextChange" },
450// Jump to previous location in the editor (useful to get back from viewing a symbol definition).
451{ "key": "alt+left", "command": "workbench.action.navigateBack" },
452// Jump to next location in the editor.
453{ "key": "alt+right", "command": "workbench.action.navigateForward" },
454// Get a blame view of the current file. Requires the annotator extension.
455{ "key": "ctrl+alt+a", "command": "annotator.annotate" },
456// Toggle header/source with the Toggle Header/Source extension (overrides the
457// key binding from the C/C++ extension as I found it to be slow).
458{ "key": "alt+o", "command": "togglehs.toggleHS" },
459// Quickly run a task, see tasks.json. Since we named them 1-, 2- etc., it is
460// suffucient to press the corresponding number.
461{ "key": "ctrl+r", "command": "workbench.action.tasks.runTask",
462 "when": "!inDebugMode" },
463// The following keybindings are useful on laptops with small keyboards such as
464// Chromebooks that don't provide all keys.
465{ "key": "shift+alt+down", "command": "cursorColumnSelectDown",
466 "when": "editorTextFocus" },
467{ "key": "shift+alt+left", "command": "cursorColumnSelectLeft",
468 "when": "editorTextFocus" },
469{ "key": "shift+alt+pagedown", "command": "cursorColumnSelectPageDown",
470 "when": "editorTextFocus" },
471{ "key": "shift+alt+pageup", "command": "cursorColumnSelectPageUp",
472 "when": "editorTextFocus" },
473{ "key": "shift+alt+right", "command": "cursorColumnSelectRight",
474 "when": "editorTextFocus" },
475{ "key": "shift+alt+up", "command": "cursorColumnSelectUp",
476 "when": "editorTextFocus" },
477{ "key": "alt+down", "command": "scrollPageDown",
478 "when": "editorTextFocus" },
479{ "key": "alt+up", "command": "scrollPageUp",
480 "when": "editorTextFocus" },
481{ "key": "alt+backspace", "command": "deleteRight",
482 "when": "editorTextFocus && !editorReadonly" },
483{ "key": "ctrl+right", "command": "cursorEnd",
484 "when": "editorTextFocus" },
485{ "key": "ctrl+shift+right", "command": "cursorEndSelect",
486 "when": "editorTextFocus" },
487{ "key": "ctrl+left", "command": "cursorHome",
488 "when": "editorTextFocus" },
489{ "key": "ctrl+shift+left", "command": "cursorHomeSelect",
490 "when": "editorTextFocus" },
491]
492```
493
494### Tips
495
496#### The `out` folder
497Automatically generated code is put into a subfolder of out/, which means that
498these files are ignored by VS Code (see files.exclude above) and cannot be
499opened e.g. from quick-open (`Ctrl+P`). On Linux, you can create a symlink as a
500work-around:
501```
502 cd ~/chromium/src
503 mkdir _out
504 ln -s ../out/Debug/gen _out/gen
505```
506We picked _out since it is already in .gitignore, so it won't show up in git
507status.
508
509Note: As of version 1.9, VS Code does not support negated glob commands, but
510once it does, you can use
511```
512"!out/Debug/gen/**": true
513```
514in files.exclude instead of the symlink.
515
516#### Using VS Code as git editor
517Add `[core] editor = "code --wait"` to your `~/.gitconfig` file in order to use
518VS Code as editor for git commit messages etc. Note that the editor starts up
519significantly slower than nano or vim. To use VS Code as merge tool, add
520`[merge] tool = code`.
521
522#### Task Names
523Note that we named the tasks `1-build_chrome_debug`, `2-build_chrome_release`
524etc. This allows you to quickly execute tasks by pressing their number:
525Press `Ctrl+P` and enter `task <n>`, where `<n>` is the number of the task. You
526can also create a keyboard shortcut for running a task. `File > Preferences >
527Keyboard Shortcuts` and add `{ "key": "ctrl+r", "command":
528"workbench.action.tasks.runTask", "when": "!inDebugMode" }`. Then it's
529sufficient to press `Ctrl+R` and enter `<n>`.
530
531#### Working on Laptop
532Because autocomplete is provided by the You-Complete-Me extension, consider
533disabling C/C++ autocomplete and indexing to save battery. In addition, you
534might want to disable git status autorefresh as well.
chaopengca285112017-03-02 15:39:04535
536```
chaopeng5c66dfe2017-03-22 13:51:45537"git.autorefresh": false,
chaopengca285112017-03-02 15:39:04538"C_Cpp.autocomplete": "Disabled",
539"C_Cpp.addWorkspaceRootToIncludePath": false
540```
541
chaopengba312ce2017-02-12 03:38:25542### More
ljustene262c842017-04-12 08:29:04543More tips and tricks can be found
sangwoo.ko5fe74c732017-09-01 14:44:56544[here](https://github.com/Microsoft/vscode-tips-and-tricks/blob/master/README.md).