Skip to content

Commit ff8142d

Browse files
committed
internal: touch up dev readme
1 parent 797185e commit ff8142d

File tree

1 file changed

+35
-38
lines changed

1 file changed

+35
-38
lines changed

docs/dev/README.md

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Contributing Quick Start
22

3-
Rust Analyzer is an ordinary Rust project, which is organized as a Cargo
4-
workspace, builds on stable and doesn't depend on C libraries. So, just
3+
Rust Analyzer is an ordinary Rust project, which is organized as a Cargo workspace, builds on stable and doesn't depend on C libraries.
4+
So, just
55

66
```
77
$ cargo test
@@ -13,9 +13,8 @@ To learn more about how rust-analyzer works, see [./architecture.md](./architect
1313
It also explains the high-level layout of the source code.
1414
Do skim through that document.
1515

16-
We also publish rustdoc docs to pages:
17-
18-
https://rust-analyzer.github.io/rust-analyzer/ide/
16+
We also publish rustdoc docs to pages: https://rust-analyzer.github.io/rust-analyzer/ide/.
17+
Note though, that internal documentation is very incomplete.
1918

2019
Various organizational and process issues are discussed in this document.
2120

@@ -49,21 +48,28 @@ https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0
4948
Also a kind of fun.
5049
These issues should generally include a link to a Zulip discussion thread.
5150

52-
# CI
51+
# Code Style & Review Process
52+
53+
Do see [./style.md](./style.md).
5354

54-
We use GitHub Actions for CI. Most of the things, including formatting, are checked by
55-
`cargo test` so, if `cargo test` passes locally, that's a good sign that CI will
56-
be green as well. The only exception is that some long-running tests are skipped locally by default.
55+
# Cookbook
56+
57+
## CI
58+
59+
We use GitHub Actions for CI.
60+
Most of the things, including formatting, are checked by `cargo test`.
61+
If `cargo test` passes locally, that's a good sign that CI will be green as well.
62+
The only exception is that some long-running tests are skipped locally by default.
5763
Use `env RUN_SLOW_TESTS=1 cargo test` to run the full suite.
5864

5965
We use bors-ng to enforce the [not rocket science](https://graydon2.dreamwidth.org/1597.html) rule.
6066

61-
# Launching rust-analyzer
67+
## Launching rust-analyzer
6268

6369
Debugging the language server can be tricky.
6470
LSP is rather chatty, so driving it from the command line is not really feasible, driving it via VS Code requires interacting with two processes.
6571

66-
For this reason, the best way to see how rust-analyzer works is to find a relevant test and execute it.
72+
For this reason, the best way to see how rust-analyzer works is to **find a relevant test and execute it**.
6773
VS Code & Emacs include an action for running a single test.
6874

6975
Launching a VS Code instance with a locally built language server is also possible.
@@ -107,49 +113,38 @@ cd editors/code
107113
npm ci
108114
npm run lint
109115
```
110-
111-
# Code Style & Review Process
112-
113-
Do see [./style.md](./style.md).
114-
115-
# How to ...
116+
## How to ...
116117

117118
* ... add an assist? [#7535](https://github.com/rust-analyzer/rust-analyzer/pull/7535)
118119
* ... add a new protocol extension? [#4569](https://github.com/rust-analyzer/rust-analyzer/pull/4569)
119120
* ... add a new configuration option? [#7451](https://github.com/rust-analyzer/rust-analyzer/pull/7451)
120121
* ... add a new completion? [#6964](https://github.com/rust-analyzer/rust-analyzer/pull/6964)
121122
* ... allow new syntax in the parser? [#7338](https://github.com/rust-analyzer/rust-analyzer/pull/7338)
122123

123-
# Logging
124+
## Logging
124125

125-
Logging is done by both rust-analyzer and VS Code, so it might be tricky to
126-
figure out where logs go.
126+
Logging is done by both rust-analyzer and VS Code, so it might be tricky to figure out where logs go.
127127

128-
Inside rust-analyzer, we use the standard `log` crate for logging, and
129-
`env_logger` for logging frontend. By default, log goes to stderr, but the
130-
stderr itself is processed by VS Code.
128+
Inside rust-analyzer, we use the standard `log` crate for logging, and `env_logger` for logging frontend.
129+
By default, log goes to stderr, but the stderr itself is processed by VS Code.
130+
`--log-file <PATH>` CLI argument allows logging to file.
131131

132-
To see stderr in the running VS Code instance, go to the "Output" tab of the
133-
panel and select `rust-analyzer`. This shows `eprintln!` as well. Note that
134-
`stdout` is used for the actual protocol, so `println!` will break things.
132+
To see stderr in the running VS Code instance, go to the "Output" tab of the panel and select `rust-analyzer`.
133+
This shows `eprintln!` as well.
134+
Note that `stdout` is used for the actual protocol, so `println!` will break things.
135135

136136
To log all communication between the server and the client, there are two choices:
137137

138138
* You can log on the server side, by running something like
139139
```
140140
env RA_LOG=lsp_server=debug code .
141141
```
142+
* You can log on the client side, by enabling `"rust-analyzer.trace.server": "verbose"` workspace setting.
143+
These logs are shown in a separate tab in the output and could be used with LSP inspector.
144+
Kudos to [@DJMcNab](https://github.com/DJMcNab) for setting this awesome infra up!
142145

143-
By default, logs go to stderr, `--log-file <PATH>` CLI argument overrides
144-
that.
145146

146-
* You can log on the client side, by enabling `"rust-analyzer.trace.server":
147-
"verbose"` workspace setting. These logs are shown in a separate tab in the
148-
output and could be used with LSP inspector. Kudos to
149-
[@DJMcNab](https://github.com/DJMcNab) for setting this awesome infra up!
150-
151-
152-
There are also two VS Code commands which might be of interest:
147+
There are also several VS Code commands which might be of interest:
153148

154149
* `Rust Analyzer: Status` shows some memory-usage statistics.
155150

@@ -167,7 +162,7 @@ There are also two VS Code commands which might be of interest:
167162

168163
![demo](https://user-images.githubusercontent.com/36276403/78225773-6636a480-74d3-11ea-9d9f-1c9d42da03b0.png)
169164

170-
# Profiling
165+
## Profiling
171166

172167
We have a built-in hierarchical profiler, you can enable it by using `RA_PROFILE` env-var:
173168

@@ -195,7 +190,9 @@ $ cargo run --release -p rust-analyzer -- analysis-bench ../chalk/ --highlight .
195190
$ cargo run --release -p rust-analyzer -- analysis-bench ../chalk/ --complete ../chalk/chalk-engine/src/logic.rs:94:0
196191
```
197192

198-
# Release Process
193+
Look for `fn benchmark_xxx` tests for a quick way to reproduce performance problems.
194+
195+
## Release Process
199196

200197
Release process is handled by `release`, `dist` and `promote` xtasks, `release` being the main one.
201198

@@ -232,7 +229,7 @@ Make sure to remove the new changelog post created when running `cargo xtask rel
232229
We release "nightly" every night automatically and promote the latest nightly to "stable" manually, every week.
233230
We don't do "patch" releases, unless something truly egregious comes up.
234231

235-
# Permissions
232+
## Permissions
236233

237234
There are three sets of people with extra permissions:
238235

0 commit comments

Comments
 (0)