summaryrefslogtreecommitdiff
path: root/chromium/docs/vscode.md
blob: 474de314aa25af70e297b1e0ed565afb8f90a7e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Use Visual Studio Code on Chromium code base

[TOC]

[Visual Studio Code](http://code.visualstudio.com/)
([Wikipedia](https://en.wikipedia.org/wiki/Visual_Studio_Code)) is a
multi-platform code editor that is itself based on Electron which is based on 
Chromium. Visual Studio Code has a growing community and base of installable 
extensions and themes. It works without too much setup.

## Install extensions

`ctrl+p` paste `ext install cpptools you-complete-me clang-format` then enter. 
For more extensions: https://marketplace.visualstudio.com/search?target=vscode

Highly recommend you also install your favorite keymap. 

An Example to install eclipse keymaps `ext install vscode-eclipse-keybindings`. 
You can search keymaps here. 
https://marketplace.visualstudio.com/search?target=vscode&category=Keymaps


## Settings

Open Settings `File/Code - Preferences - Settings` and add the following 
settings.

```
{
  "editor.tabSize": 2,
  "editor.rulers": [80],
  // Exclude
  "files.exclude": {
    "**/.git": true,
    "**/.svn": true,
    "**/.hg": true,
    "**/.DS_Store": true,
    "**/out": true
  },
  // YCM
  "ycmd.path": "<your_ycmd_path>",
  "ycmd.global_extra_config": 
      "<your_chromium_path>/src/tools/vim/chromium.ycm_extra_conf.py",
  "ycmd.confirm_extra_conf": false,
  "ycmd.use_imprecise_get_type": true,
  // clang-format
  "clang-format.style": "Chromium",
  "editor.formatOnSave": true
}
```

### Install auto-completion engine(ycmd)

```
$ git clone https://github.com/Valloric/ycmd.git ~/.ycmd
$ cd ~/.ycmd
$ ./build.py --clang-completer
```

## Work flow

1. `ctrl+p` open file.
2. `ctrl+o` goto symbol. `ctrl+l` goto line.
3. <code>ctrl+`</code> toggle terminal.

## Tips

### On laptop

Because we use ycmd to enable auto completion. We can disable CPP autocomplete 
and index to save battery. 

```
"C_Cpp.autocomplete": "Disabled",
"C_Cpp.addWorkspaceRootToIncludePath": false
```

### Enable Sublime-like minimap

```
"editor.minimap.enabled": true,
"editor.minimap.renderCharacters": false
```

### More

https://github.com/Microsoft/vscode-tips-and-tricks/blob/master/README.md