blob: 496dacac3737d58dac8794a13359686d0b4fbf3f [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
41guidelines](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/documentation_guidelines.md)
42and [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++*** -
66 Intellisense, code formatting, debugging.
67* ***Python*** -
68 Linting, intellisense, code formatting, refactoring, debugging, snippets.
69* ***Toggle Header/Source*** -
70 Toggles between .cc and .h with `F4`. The C/C++ extension supports this as
71 well through `Alt+O`. Last time I checked this was very laggy, but they
72 might have improved it since, so this extension might not be necessary.
73* ***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
85$ ./build.py --clang-completer
86```
87
ljustene262c842017-04-12 08:29:0488The following extensions might be useful for you as well:
chaopengba312ce2017-02-12 03:38:2589
ljustene262c842017-04-12 08:29:0490* ***Annotator*** -
91 Git blame view.
92* ***Git History (git log)*** -
93 Git history view.
94* ***chromium-codesearch*** -
95 Code search (CS) integration, see [Chromium Code
96 Search](https://cs.chromium.org/), in particular *open current line in CS*,
97 *show references* and *go to definition*. Very useful for existing code. By
98 design, won't work for code not checked in yet. Overrides default C/C++
99 functionality. Had some issues last time I tried (extensions stopped
100 working), so use with care.
101* ***change-case*** -
102 Quickly change the case of the current selection or current word.
103* ***Instant Markdown*** -
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.
chaopengba312ce2017-02-12 03:38:25111
ljustene262c842017-04-12 08:29:04112Also be sure to take a look at the
113[VS Code marketplace](https://marketplace.visualstudio.com/VSCode) to check out other
114useful extensions.
chaopengba312ce2017-02-12 03:38:25115
ljustene262c842017-04-12 08:29:04116### Color Scheme
117Press `Ctrl+Shift+P, color, Enter` to pick a color scheme for the editor. There
118are also tons of [color schemes available for download on the
119marketplace](https://marketplace.visualstudio.com/search?target=VSCode&category=Themes&sortBy=Downloads).
chaopengba312ce2017-02-12 03:38:25120
ljustene262c842017-04-12 08:29:04121### 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
147VS Code is configured via JSON files. This paragraph contains JSON configuration
148files that are useful for Chromium development, in particular. See [VS Code
149documentation](https://code.visualstudio.com/docs/customization/overview) for an
150introduction to VS Code customization.
151
152### Workspace Settings
153Open the file chromium/src/.vscode/settings.json and add the following settings.
154Remember 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
dullwebera347f0eb2017-04-27 14:20:32194 "files.watcherExclude": {
dullweber48be1582017-04-28 09:40:25195 // Don't watch out*/ and third_party/ for changes to fix an issue
dullwebera347f0eb2017-04-27 14:20:32196 // where vscode doesn't notice that files have changed.
197 // https://github.com/Microsoft/vscode/issues/3998
dullweber48be1582017-04-28 09:40:25198 // There is currently another issue that requires a leading **/ for
199 // watcherExlude. Beware that this pattern might affect other out* folders
200 // like src/cc/output/.
201 "**/out*/**": true,
dullwebera347f0eb2017-04-27 14:20:32202 "**/third_party/**": true
203 },
204
ljustene262c842017-04-12 08:29:04205 // Wider author column for annotator extension.
206 "annotator.annotationColumnWidth": "24em",
207
208 // C++ clang format settings.
209 "C_Cpp.clang_format_path": "<full_path_to_your_home>/depot_tools/clang-format",
210 "C_Cpp.clang_format_sortIncludes": true,
211 "C_Cpp.clang_format_formatOnSave": true,
212
213 // YouCompleteMe
214 "ycmd.path": "<full_path_to_your_home>/.vim/bundle/YouCompleteMe/third_party/ycmd",
215 "ycmd.global_extra_config": "<full_path_to_your_home>/chromium/src/tools/vim/.ycm_extra_conf.py",
216 "ycmd.confirm_extra_conf": false,
217}
218```
219
220### Tasks
221Next, we'll tell VS Code how to compile our code and how to read warnings and
222errors from the build output. Copy the code below to
223chromium/src/.vscode/tasks.json. This will provide 5 tasks to do basic things.
224You might have to adjust the commands to your situation and needs.
225
226```
227{
228 "version": "0.1.0",
229 "_runner": "terminal",
230 "showOutput": "always",
231 "echoCommand": true,
232 "tasks": [
233 {
234 "taskName": "1-build_chrome_debug",
235 "command": "ninja -C out/Debug -j 2000 chrome",
236 "isShellCommand": true,
237 "isTestCommand": true,
Lutz Justend4982792017-05-05 15:07:26238 "problemMatcher": [
239 {
ljustene262c842017-04-12 08:29:04240 "owner": "cpp",
241 "fileLocation": ["relative", "${workspaceRoot}"],
242 "pattern": {
243 "regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
244 "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
245 }
Lutz Justend4982792017-05-05 15:07:26246 },
247 {
248 "owner": "cpp",
249 "fileLocation": ["relative", "${workspaceRoot}"],
250 "pattern": {
251 "regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
252 "file": 1, "severity": 3, "message": 4
253 }
254 }]
ljustene262c842017-04-12 08:29:04255 },
256 {
257 "taskName": "2-build_chrome_release",
258 "command": "ninja -C out/Release -j 2000 chrome",
259 "isShellCommand": true,
260 "isBuildCommand": true,
Lutz Justend4982792017-05-05 15:07:26261 "problemMatcher": [
262 {
ljustene262c842017-04-12 08:29:04263 "owner": "cpp",
264 "fileLocation": ["relative", "${workspaceRoot}"],
265 "pattern": {
266 "regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
267 "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
268 }
Lutz Justend4982792017-05-05 15:07:26269 },
270 {
271 "owner": "cpp",
272 "fileLocation": ["relative", "${workspaceRoot}"],
273 "pattern": {
274 "regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
275 "file": 1, "severity": 3, "message": 4
276 }
277 }]
ljustene262c842017-04-12 08:29:04278 },
279 {
280 "taskName": "3-build_all_debug",
281 "command": "ninja -C out/Debug -j 2000",
282 "isShellCommand": true,
Lutz Justend4982792017-05-05 15:07:26283 "problemMatcher": [
284 {
ljustene262c842017-04-12 08:29:04285 "owner": "cpp",
286 "fileLocation": ["relative", "${workspaceRoot}"],
287 "pattern": {
288 "regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
289 "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
290 }
Lutz Justend4982792017-05-05 15:07:26291 },
292 {
293 "owner": "cpp",
294 "fileLocation": ["relative", "${workspaceRoot}"],
295 "pattern": {
296 "regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
297 "file": 1, "severity": 3, "message": 4
298 }
299 }]
ljustene262c842017-04-12 08:29:04300 },
301 {
302 "taskName": "4-build_all_release",
303 "command": "ninja -C out/Release -j 2000",
304 "isShellCommand": true,
Lutz Justend4982792017-05-05 15:07:26305 "problemMatcher": [
306 {
ljustene262c842017-04-12 08:29:04307 "owner": "cpp",
308 "fileLocation": ["relative", "${workspaceRoot}"],
309 "pattern": {
310 "regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
311 "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
312 }
Lutz Justend4982792017-05-05 15:07:26313 },
314 {
315 "owner": "cpp",
316 "fileLocation": ["relative", "${workspaceRoot}"],
317 "pattern": {
318 "regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
319 "file": 1, "severity": 3, "message": 4
320 }
321 }]
ljustene262c842017-04-12 08:29:04322 },
323 {
324 "taskName": "5-build_test_debug",
325 "command": "ninja -C out/Debug -j 2000 unit_tests components_unittests browser_tests",
326 "isShellCommand": true,
Lutz Justend4982792017-05-05 15:07:26327 "problemMatcher": [
328 {
ljustene262c842017-04-12 08:29:04329 "owner": "cpp",
330 "fileLocation": ["relative", "${workspaceRoot}"],
331 "pattern": {
332 "regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
333 "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
334 }
Lutz Justend4982792017-05-05 15:07:26335 },
336 {
337 "owner": "cpp",
338 "fileLocation": ["relative", "${workspaceRoot}"],
339 "pattern": {
340 "regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
341 "file": 1, "severity": 3, "message": 4
342 }
343 }]
ljustene262c842017-04-12 08:29:04344 }]
345}
346```
347
348### Launch Commands
349Launch commands are the equivalent of `F5` in Visual Studio: They launch some
350program or a debugger. Optionally, they can run some task defined in
351`tasks.json`. Launch commands can be run from the debug view (`Ctrl+Shift+D`).
352Copy the code below to chromium/src/.vscode/launch.json and adjust them to
353your situation and needs.
354```
355{
356 "version": "0.2.0",
357 "configurations": [
358 {
359 "name": "Chrome Debug",
360 "type": "cppdbg",
361 "request": "launch",
362 "targetArchitecture": "x64",
363 "program": "${workspaceRoot}/out/Debug/chrome",
364 "args": [], // Optional command line args
365 "preLaunchTask": "1-build_chrome_debug",
366 "stopAtEntry": false,
367 "cwd": "${workspaceRoot}",
368 "environment": [],
369 "externalConsole": true
370 },
371 {
372 "name": "Chrome Release",
373 "type": "cppdbg",
374 "request": "launch",
375 "targetArchitecture": "x64",
376 "program": "${workspaceRoot}/out/Release/chrome",
377 "args": [], // Optional command line args
378 "preLaunchTask": "2-build_chrome_release",
379 "stopAtEntry": false,
380 "cwd": "${workspaceRoot}",
381 "environment": [],
382 "externalConsole": true
383 },
384 {
385 "name": "Custom Test Debug",
386 "type": "cppdbg",
387 "request": "launch",
388 "targetArchitecture": "x64",
389 "program": "${workspaceRoot}/out/Debug/unit_tests",
390 "args": ["--gtest_filter=*",
391 "--single_process",
392 "--ui-test-action-max-timeout=1000000",
393 "--test-launcher-timeout=1000000"],
394 "preLaunchTask": "5-build_test_debug",
395 "stopAtEntry": false,
396 "cwd": "${workspaceRoot}",
397 "environment": [],
398 "externalConsole": true
399 },
400 {
401 "name": "Attach Debug",
402 "type": "cppdbg",
403 "request": "launch",
404 "targetArchitecture": "x64",
405 "program": "${workspaceRoot}/out/Debug/chrome",
406 "args": ["--remote-debugging-port=2224"],
407 "stopAtEntry": false,
408 "cwd": "${workspaceRoot}",
409 "environment": [],
410 "externalConsole": false
411 }]
412}
413```
414
415### Key Bindings
416To edit key bindings, press `Ctrl+K, Ctrl+S`. You'll see the defaults on the
417left and your overrides on the right stored in the file `keybindings.json`. To
418change a key binding, copy the corresponding key binding to the right. It's
419fairly self-explanatory.
420
421You can bind any command to a key, even commands specified by extensions like
422`CodeSearchOpen`. For instance, to bind `CodeSearchOpen` to `F2` to , simply add
423`{ "key": "F2", "command": "cs.open" },`.
424Note that the command title `CodeSearchOpen` won't work. You have to get the
425actual command name from the [package.json
426file](https://github.com/chaopeng/vscode-chromium-codesearch/blob/master/package.json)
427of the extension.
428
429If you are used to other editors, you can also install your favorite keymap.
430For instance, to install eclipse keymaps, install the
431`vscode-eclipse-keybindings` extension. More keymaps can be found
432[in the marketplace](https://marketplace.visualstudio.com/search?target=vscode&category=Keymaps).
433
434Here are some key bindings that are likely to be useful for you:
435
436```
437// Place your key bindings in this file to overwrite the defaults
438[
439// Run the task marked as "isTestCommand": true, see tasks.json.
440{ "key": "ctrl+shift+t", "command": "workbench.action.tasks.test" },
441// Jump to the previous change in the built-in diff tool.
442{ "key": "ctrl+up", "command": "workbench.action.compareEditor.previousChange" },
443// Jump to the next change in the built-in diff tool.
444{ "key": "ctrl+down", "command": "workbench.action.compareEditor.nextChange" },
445// Jump to previous location in the editor (useful to get back from viewing a symbol definition).
446{ "key": "alt+left", "command": "workbench.action.navigateBack" },
447// Jump to next location in the editor.
448{ "key": "alt+right", "command": "workbench.action.navigateForward" },
449// Get a blame view of the current file. Requires the annotator extension.
450{ "key": "ctrl+alt+a", "command": "annotator.annotate" },
451// Toggle header/source with the Toggle Header/Source extension (overrides the
452// key binding from the C/C++ extension as I found it to be slow).
453{ "key": "alt+o", "command": "togglehs.toggleHS" },
454// Quickly run a task, see tasks.json. Since we named them 1-, 2- etc., it is
455// suffucient to press the corresponding number.
456{ "key": "ctrl+r", "command": "workbench.action.tasks.runTask",
457 "when": "!inDebugMode" },
458// The following keybindings are useful on laptops with small keyboards such as
459// Chromebooks that don't provide all keys.
460{ "key": "shift+alt+down", "command": "cursorColumnSelectDown",
461 "when": "editorTextFocus" },
462{ "key": "shift+alt+left", "command": "cursorColumnSelectLeft",
463 "when": "editorTextFocus" },
464{ "key": "shift+alt+pagedown", "command": "cursorColumnSelectPageDown",
465 "when": "editorTextFocus" },
466{ "key": "shift+alt+pageup", "command": "cursorColumnSelectPageUp",
467 "when": "editorTextFocus" },
468{ "key": "shift+alt+right", "command": "cursorColumnSelectRight",
469 "when": "editorTextFocus" },
470{ "key": "shift+alt+up", "command": "cursorColumnSelectUp",
471 "when": "editorTextFocus" },
472{ "key": "alt+down", "command": "scrollPageDown",
473 "when": "editorTextFocus" },
474{ "key": "alt+up", "command": "scrollPageUp",
475 "when": "editorTextFocus" },
476{ "key": "alt+backspace", "command": "deleteRight",
477 "when": "editorTextFocus && !editorReadonly" },
478{ "key": "ctrl+right", "command": "cursorEnd",
479 "when": "editorTextFocus" },
480{ "key": "ctrl+shift+right", "command": "cursorEndSelect",
481 "when": "editorTextFocus" },
482{ "key": "ctrl+left", "command": "cursorHome",
483 "when": "editorTextFocus" },
484{ "key": "ctrl+shift+left", "command": "cursorHomeSelect",
485 "when": "editorTextFocus" },
486]
487```
488
489### Tips
490
491#### The `out` folder
492Automatically generated code is put into a subfolder of out/, which means that
493these files are ignored by VS Code (see files.exclude above) and cannot be
494opened e.g. from quick-open (`Ctrl+P`). On Linux, you can create a symlink as a
495work-around:
496```
497 cd ~/chromium/src
498 mkdir _out
499 ln -s ../out/Debug/gen _out/gen
500```
501We picked _out since it is already in .gitignore, so it won't show up in git
502status.
503
504Note: As of version 1.9, VS Code does not support negated glob commands, but
505once it does, you can use
506```
507"!out/Debug/gen/**": true
508```
509in files.exclude instead of the symlink.
510
511#### Using VS Code as git editor
512Add `[core] editor = "code --wait"` to your `~/.gitconfig` file in order to use
513VS Code as editor for git commit messages etc. Note that the editor starts up
514significantly slower than nano or vim. To use VS Code as merge tool, add
515`[merge] tool = code`.
516
517#### Task Names
518Note that we named the tasks `1-build_chrome_debug`, `2-build_chrome_release`
519etc. This allows you to quickly execute tasks by pressing their number:
520Press `Ctrl+P` and enter `task <n>`, where `<n>` is the number of the task. You
521can also create a keyboard shortcut for running a task. `File > Preferences >
522Keyboard Shortcuts` and add `{ "key": "ctrl+r", "command":
523"workbench.action.tasks.runTask", "when": "!inDebugMode" }`. Then it's
524sufficient to press `Ctrl+R` and enter `<n>`.
525
526#### Working on Laptop
527Because autocomplete is provided by the You-Complete-Me extension, consider
528disabling C/C++ autocomplete and indexing to save battery. In addition, you
529might want to disable git status autorefresh as well.
chaopengca285112017-03-02 15:39:04530
531```
chaopeng5c66dfe2017-03-22 13:51:45532"git.autorefresh": false,
chaopengca285112017-03-02 15:39:04533"C_Cpp.autocomplete": "Disabled",
534"C_Cpp.addWorkspaceRootToIncludePath": false
535```
536
chaopengba312ce2017-02-12 03:38:25537### More
ljustene262c842017-04-12 08:29:04538More tips and tricks can be found
539[here](https://github.com/Microsoft/vscode-tips-and-tricks/blob/master/README.md).