OLD | NEW |
(Empty) | |
| 1 # Use Visual Studio Code on Chromium code base |
| 2 |
| 3 [Visual Studio Code](http://code.visualstudio.com/) |
| 4 ([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 |
| 6 Chromium. Visual Studio Code has a growing community and base of installable |
| 7 extensions and themes. It works without too much setup. |
| 8 |
| 9 ## Install extensions |
| 10 |
| 11 `ctrl+p` paste `ext install cpptools you-complete-me` then enter. |
| 12 For more extensions: https://marketplace.visualstudio.com/search?target=vscode |
| 13 |
| 14 Highly recommend you also install your favorite keymap. |
| 15 |
| 16 An Example to install eclipse keymaps `ext install vscode-eclipse-keybindings`. |
| 17 You can search keymaps here. |
| 18 https://marketplace.visualstudio.com/search?target=vscode&category=Keymaps |
| 19 |
| 20 |
| 21 ## Settings |
| 22 |
| 23 Open Settings `File/Code - Preferences - Settings` and add the following |
| 24 settings. |
| 25 |
| 26 ``` |
| 27 { |
| 28 "editor.tabSize": 2, |
| 29 "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 |
| 34 "files.exclude": { |
| 35 "**/.git": true, |
| 36 "**/.svn": true, |
| 37 "**/.hg": true, |
| 38 "**/.DS_Store": true, |
| 39 "**/out": true |
| 40 }, |
| 41 // YCM |
| 42 "ycmd.path": "<your_ycmd_path>", |
| 43 "ycmd.global_extra_config": |
| 44 "<your_chromium_path>/src/tools/vim/chromium.ycm_extra_conf.py", |
| 45 "ycmd.confirm_extra_conf": false, |
| 46 "ycmd.use_imprecise_get_type": true |
| 47 } |
| 48 ``` |
| 49 |
| 50 ### Install auto-completion engine(ycmd) |
| 51 |
| 52 ``` |
| 53 $ git clone https://github.com/Valloric/ycmd.git ~/.ycmd |
| 54 $ cd ~/.ycmd |
| 55 $ ./build.py --clang-completer |
| 56 ``` |
| 57 |
| 58 ## Work flow |
| 59 |
| 60 1. `ctrl+p` open file. |
| 61 2. `ctrl+shift+o` goto symbol. `ctrl+l` goto line. |
| 62 3. <code>ctrl+`</code> toggle terminal. |
| 63 |
| 64 ## Tips |
| 65 |
| 66 ### On laptop |
| 67 |
| 68 Because we use ycmd to enable auto completion. we can disable CPP autocomplete |
| 69 to save battery. `"C_Cpp.autocomplete": "Disabled"` |
| 70 |
| 71 ### More |
| 72 |
| 73 https://github.com/Microsoft/vscode-tips-and-tricks/blob/master/README.md |
OLD | NEW |