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