blob: 999b3844200ea7952a773ec8490f38954074519a [file] [log] [blame] [view]
rouslan357569e2016-08-15 00:49:351# Atom
2
3[TOC]
4
5## Workflow
6
7A typical Atom workflow consists of the following.
8
91. Use `Ctrl-Shift-R` to find a symbol in the `.tags` file or `Ctrl-P` to find
10 a file by name.
112. Switch between the header and the source using `Alt-O`.
123. While editing, `you-complete-me` package helps with C++ auto-completion and
13 shows compile errors through `lint` package.
144. Press `Ctrl-Shift-P` and type `format<Enter>` to format the code.
155. Select the target to build by pressing `F7` and typing, for example,
16 `base_unittests`.
176. Rebuild again by pressing `F9`.
18
19## Atom packages
20
21To setup this workflow, install Atom packages for Chrome development.
22
23```
24$ apm install build-ninja clang-format \
25 linter linter-eslint switch-header-source you-complete-me
26```
27
28## Autocomplete
29
30Install C++ auto-completion engine.
31
32```
33$ git clone https://github.com/Valloric/ycmd.git ~/.ycmd
34$ cd ~/.ycmd
35$ ./build.py --clang-completer
36```
37
38## JavaScript lint
39
40Install JavaScript linter for Blink layout tests.
41
42```
43$ npm install -g eslint eslint-config-google
44```
45
46Configure the JavaScript linter to use the Google style by default by replacing
47the contents of `~/.eslintrc` with the following.
48
49```
50{
51 "extends": "google",
52 "env": {
53 "browser": true
54 }
55}
56```
57
58## Configuration
59
60Configure Atom by replacing the contents of `~/.atom/config.cson` with the
61following. Replace `<path-of-your-home-dir>` and
62`<path-of-your-chrome-checkout>` with the actual full paths of your home
63directory and chrome checkout. For example, these can be `/Users/bob` and
64`/Users/bob/chrome/src`.
65
66```
67"*":
68 # Configure ninja builder.
69 "build-ninja":
70 ninjaOptions: [
71 # The number of jobs to use when running ninja. Adjust to taste.
72 "-j10"
73 ]
74 subdirs: [
75 # The location of your build.ninja file.
76 "out/gn"
77 ]
78 # Do not auto-format entire files on save.
79 "clang-format":
80 formatCOnSave: false
81 formatCPlusPlusOnSave: false
82 core:
83 # Treat .h files as C++.
84 customFileTypes:
85 "source.cpp": [
86 "h"
87 ]
88 # Don't send metrics if you're working on anything sensitive.
89 disabledPackages: [
90 "metrics"
91 "exception-reporting"
92 ]
93 # Use spaces instead of tabs.
94 editor:
95 tabType: "soft"
96 # Show lint errors only when you save the file.
97 linter:
98 lintOnFly: false
99 # Configure JavaScript lint.
100 "linter-eslint":
101 eslintrcPath: "<path-of-your-home-dir>/.eslintrc"
102 useGlobalEslint: true
103 # Don't show ignored files in the project file browser.
104 "tree-view":
105 hideIgnoredNames: true
106 hideVcsIgnoredFiles: true
107 # Configure C++ autocomplete and lint.
108 "you-complete-me":
109 globalExtraConfig: "<path-of-your-chrome-checkout>/tools/vim/chromium.ycm_extra_conf.py"
110 ycmdPath: "<path-of-your-home-dir>/.ycmd/"
111# Java uses 4 space indents and 100 character lines.
112".java.source":
113 editor:
114 preferredLineLength: 100
115 tabLength: 4
116```
117
118## Symbol lookup
119
120Atom fuzzy file finder is slow to index all files in Chrome. If you're working
121on a project that frequently uses `foo` or `bar` in files names, you can create
122a small `.tags` file to efficiently search the symbols within these files. Be
123sure to use "Exuberant Ctags."
124
125```
126$ git ls | egrep -i "foo|bar" | ctags -f .tags -L -
127```
128
129Don't create a ctags file for the full Chrome repository, as that would result
130in ~9GB tag file that will not be usable in Atom.