blob: db4c0f9004ab11cdd0490e30f5c2bfcf952d670a [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
Victor Costan1a504072018-02-20 20:10:2549On Mac, replace the last command above with the following.
50
51```
52$ ./build.py --clang-completer --system-libclang
53```
54
rouslan357569e2016-08-15 00:49:3555## JavaScript lint
56
Kent Tamura59ffb022018-11-27 05:30:5657Install JavaScript linter for Blink web tests.
rouslan357569e2016-08-15 00:49:3558
59```
60$ npm install -g eslint eslint-config-google
61```
62
63Configure the JavaScript linter to use the Google style by default by replacing
64the contents of `~/.eslintrc` with the following.
65
66```
67{
68 "extends": "google",
69 "env": {
70 "browser": true
71 }
72}
73```
74
75## Configuration
76
77Configure Atom by replacing the contents of `~/.atom/config.cson` with the
78following. Replace `<path-of-your-home-dir>` and
79`<path-of-your-chrome-checkout>` with the actual full paths of your home
80directory and chrome checkout. For example, these can be `/Users/bob` and
81`/Users/bob/chrome/src`.
82
83```
84"*":
85 # Configure ninja builder.
86 "build-ninja":
87 ninjaOptions: [
88 # The number of jobs to use when running ninja. Adjust to taste.
89 "-j10"
90 ]
91 subdirs: [
92 # The location of your build.ninja file.
93 "out/gn"
94 ]
95 # Do not auto-format entire files on save.
96 "clang-format":
97 formatCOnSave: false
98 formatCPlusPlusOnSave: false
99 core:
100 # Treat .h files as C++.
101 customFileTypes:
102 "source.cpp": [
103 "h"
104 ]
105 # Don't send metrics if you're working on anything sensitive.
106 disabledPackages: [
107 "metrics"
108 "exception-reporting"
109 ]
110 # Use spaces instead of tabs.
111 editor:
112 tabType: "soft"
113 # Show lint errors only when you save the file.
114 linter:
115 lintOnFly: false
116 # Configure JavaScript lint.
117 "linter-eslint":
118 eslintrcPath: "<path-of-your-home-dir>/.eslintrc"
119 useGlobalEslint: true
120 # Don't show ignored files in the project file browser.
121 "tree-view":
122 hideIgnoredNames: true
123 hideVcsIgnoredFiles: true
124 # Configure C++ autocomplete and lint.
125 "you-complete-me":
126 globalExtraConfig: "<path-of-your-chrome-checkout>/tools/vim/chromium.ycm_extra_conf.py"
127 ycmdPath: "<path-of-your-home-dir>/.ycmd/"
128# Java uses 4 space indents and 100 character lines.
129".java.source":
130 editor:
131 preferredLineLength: 100
132 tabLength: 4
133```
134
135## Symbol lookup
136
137Atom fuzzy file finder is slow to index all files in Chrome. If you're working
138on a project that frequently uses `foo` or `bar` in files names, you can create
139a small `.tags` file to efficiently search the symbols within these files. Be
140sure to use "Exuberant Ctags."
141
142```
143$ git ls | egrep -i "foo|bar" | ctags -f .tags -L -
144```
145
146Don't create a ctags file for the full Chrome repository, as that would result
147in ~9GB tag file that will not be usable in Atom.