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