diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/dev/architecture.md | 4 | ||||
-rw-r--r-- | docs/user/README.md | 18 | ||||
-rw-r--r-- | docs/user/features.md | 18 |
3 files changed, 34 insertions, 6 deletions
diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md index 1201f6e5a..1ffabc6ef 100644 --- a/docs/dev/architecture.md +++ b/docs/dev/architecture.md | |||
@@ -79,9 +79,7 @@ Rust syntax tree structure and parser. See | |||
79 | - `grammar.ron` RON description of the grammar, which is used to | 79 | - `grammar.ron` RON description of the grammar, which is used to |
80 | generate `syntax_kinds` and `ast` modules, using `cargo gen-syntax` command. | 80 | generate `syntax_kinds` and `ast` modules, using `cargo gen-syntax` command. |
81 | - `algo`: generic tree algorithms, including `walk` for O(1) stack | 81 | - `algo`: generic tree algorithms, including `walk` for O(1) stack |
82 | space tree traversal (this is cool) and `visit` for type-driven | 82 | space tree traversal (this is cool). |
83 | visiting the nodes (this is double plus cool, if you understand how | ||
84 | `Visitor` works, you understand the design of syntax trees). | ||
85 | 83 | ||
86 | Tests for ra_syntax are mostly data-driven: `test_data/parser` contains subdirectories with a bunch of `.rs` | 84 | Tests for ra_syntax are mostly data-driven: `test_data/parser` contains subdirectories with a bunch of `.rs` |
87 | (test vectors) and `.txt` files with corresponding syntax trees. During testing, we check | 85 | (test vectors) and `.txt` files with corresponding syntax trees. During testing, we check |
diff --git a/docs/user/README.md b/docs/user/README.md index 9d03cad1c..036b51d58 100644 --- a/docs/user/README.md +++ b/docs/user/README.md | |||
@@ -45,7 +45,7 @@ should adapt these manual installation instructions: | |||
45 | ``` | 45 | ``` |
46 | $ git clone https://github.com/rust-analyzer/rust-analyzer.git --depth 1 | 46 | $ git clone https://github.com/rust-analyzer/rust-analyzer.git --depth 1 |
47 | $ cd rust-analyzer | 47 | $ cd rust-analyzer |
48 | $ cargo install --path ./crates/ra_lsp_server/ --force | 48 | $ cargo install --path ./crates/ra_lsp_server/ --force --locked |
49 | $ cd ./editors/code | 49 | $ cd ./editors/code |
50 | $ npm install | 50 | $ npm install |
51 | $ ./node_modules/vsce/out/vsce package | 51 | $ ./node_modules/vsce/out/vsce package |
@@ -116,6 +116,22 @@ to load path and require it in `init.el` | |||
116 | [coc-vim-conf]: https://github.com/neoclide/coc.nvim/#example-vim-configuration | 116 | [coc-vim-conf]: https://github.com/neoclide/coc.nvim/#example-vim-configuration |
117 | [coc-rust-analyzer]: https://github.com/fannheyward/coc-rust-analyzer | 117 | [coc-rust-analyzer]: https://github.com/fannheyward/coc-rust-analyzer |
118 | 118 | ||
119 | ## Vim and NeoVim Alternative | ||
120 | |||
121 | * Install LanguageClient-neovim by following the instructions [here][lang-client-neovim] | ||
122 | - No extra run-time is required as this server is written in Rust | ||
123 | - The github project wiki has extra tips on configuration | ||
124 | |||
125 | * Configure by adding this to your vim/neovim config file (replacing the existing rust specific line if it exists): | ||
126 | |||
127 | ``` | ||
128 | let g:LanguageClient_serverCommands = { | ||
129 | \ 'rust': ['ra_lsp_server'], | ||
130 | \ } | ||
131 | ``` | ||
132 | |||
133 | [lang-client-neovim]: https://github.com/autozimu/LanguageClient-neovim | ||
134 | |||
119 | 135 | ||
120 | ## Sublime Text 3 | 136 | ## Sublime Text 3 |
121 | 137 | ||
diff --git a/docs/user/features.md b/docs/user/features.md index eb81cba26..757a02838 100644 --- a/docs/user/features.md +++ b/docs/user/features.md | |||
@@ -166,6 +166,20 @@ impl Foo for S { | |||
166 | } | 166 | } |
167 | ``` | 167 | ``` |
168 | 168 | ||
169 | - Apply [De Morgan's law](https://en.wikipedia.org/wiki/De_Morgan%27s_laws) | ||
170 | |||
171 | ```rust | ||
172 | // before: | ||
173 | fn example(x: bool) -> bool { | ||
174 | !x || !x | ||
175 | } | ||
176 | |||
177 | // after: | ||
178 | fn example(x: bool) -> bool { | ||
179 | !(x && x) | ||
180 | } | ||
181 | ``` | ||
182 | |||
169 | - Import path | 183 | - Import path |
170 | 184 | ||
171 | ```rust | 185 | ```rust |
@@ -353,9 +367,9 @@ impl VariantData { | |||
353 | 367 | ||
354 | ```rust | 368 | ```rust |
355 | // before: | 369 | // before: |
356 | use algo:<|>:visitor::{Visitor, visit}; | 370 | use crate:<|>:db::{RootDatabase, FileSymbol}; |
357 | // after: | 371 | // after: |
358 | use algo::{<|>visitor::{Visitor, visit}}; | 372 | use crate::{<|>db::{RootDatabase, FileSymbol}}; |
359 | ``` | 373 | ``` |
360 | 374 | ||
361 | - Flip binary expression | 375 | - Flip binary expression |