OLD | NEW |
| (Empty) |
1 # Use Visual Studio Code on Chromium code base | |
2 | |
3 [TOC] | |
4 | |
5 [Visual Studio Code](http://code.visualstudio.com/) | |
6 ([Wikipedia](https://en.wikipedia.org/wiki/Visual_Studio_Code)) is a | |
7 multi-platform code editor that is itself based on Electron which is based on | |
8 Chromium. Visual Studio Code has a growing community and base of installable | |
9 extensions and themes. It works without too much setup. | |
10 | |
11 ## Install extensions | |
12 | |
13 `F1` paste | |
14 `ext install cpptools you-complete-me clang-format chromium-codesearch` | |
15 then enter. For more extensions: | |
16 https://marketplace.visualstudio.com/search?target=vscode | |
17 | |
18 Highly recommend you also install your favorite keymap. | |
19 | |
20 An Example to install eclipse keymaps `ext install vscode-eclipse-keybindings`. | |
21 You can search keymaps here. | |
22 https://marketplace.visualstudio.com/search?target=vscode&category=Keymaps | |
23 | |
24 | |
25 ## Settings | |
26 | |
27 Open Settings `File/Code - Preferences - Settings` and add the following | |
28 settings. | |
29 | |
30 ``` | |
31 { | |
32 "editor.tabSize": 2, | |
33 "editor.rulers": [80], | |
34 "[cpp]": { | |
35 "editor.quickSuggestions": true | |
36 }, | |
37 // Exclude | |
38 "files.exclude": { | |
39 "**/.git": true, | |
40 "**/.svn": true, | |
41 "**/.hg": true, | |
42 "**/.DS_Store": true, | |
43 "**/out": true | |
44 }, | |
45 // YCM | |
46 "ycmd.path": "<your_ycmd_path>", | |
47 "ycmd.global_extra_config": | |
48 "<your_chromium_path>/src/tools/vim/chromium.ycm_extra_conf.py", | |
49 "ycmd.confirm_extra_conf": false, | |
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 | |
59 ``` | |
60 $ git clone https://github.com/Valloric/ycmd.git ~/.ycmd | |
61 $ cd ~/.ycmd | |
62 $ ./build.py --clang-completer | |
63 ``` | |
64 | |
65 ## Work flow | |
66 | |
67 1. `ctrl+p` open file. | |
68 2. `ctrl+o` goto symbol. `ctrl+l` goto line. | |
69 3. <code>ctrl+`</code> toggle terminal. | |
70 4. `F1` - `CodeSearchOpen` open current line in code search on chrome. | |
71 5. `F1` - `CodeSearchReferences` open XRef Infomation of current symbol. | |
72 6. Use right click menu call `go to definition` or `peek definition`. | |
73 7. Use right click menu call `find all references`. | |
74 | |
75 ## Tips | |
76 | |
77 ### On laptop | |
78 | |
79 Because we use ycmd to enable auto completion. We can disable CPP autocomplete | |
80 and index to save battery. We can also disable git status autorefresh to save | |
81 battery. | |
82 | |
83 ``` | |
84 "git.autorefresh": false, | |
85 "C_Cpp.autocomplete": "Disabled", | |
86 "C_Cpp.addWorkspaceRootToIncludePath": false | |
87 ``` | |
88 | |
89 ### Enable Sublime-like minimap | |
90 | |
91 ``` | |
92 "editor.minimap.enabled": true, | |
93 "editor.minimap.renderCharacters": false | |
94 ``` | |
95 | |
96 ### More | |
97 | |
98 https://github.com/Microsoft/vscode-tips-and-tricks/blob/master/README.md | |
OLD | NEW |