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