diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-10-26 19:23:59 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-10-26 19:23:59 +0100 |
commit | 85984b09e182adca4b03d9f7efab20d48b5b632a (patch) | |
tree | 0c7309c896b50663418f6b45a0df36336d92fc43 | |
parent | 106004139375b64817145d8279cd7904a477c637 (diff) | |
parent | cf4720ffd5524f1ddda411e4810da8d97a0c593f (diff) |
Merge #2081
2081: use unicode bar for drawing the cursor r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r-- | crates/ra_assists/src/assists/change_visibility.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/doc_tests/generated.rs | 2 | ||||
-rw-r--r-- | docs/user/assists.md | 29 | ||||
-rw-r--r-- | xtask/src/codegen/gen_assists_docs.rs | 8 |
4 files changed, 24 insertions, 17 deletions
diff --git a/crates/ra_assists/src/assists/change_visibility.rs b/crates/ra_assists/src/assists/change_visibility.rs index 88118cdf7..bed343677 100644 --- a/crates/ra_assists/src/assists/change_visibility.rs +++ b/crates/ra_assists/src/assists/change_visibility.rs | |||
@@ -16,7 +16,7 @@ use crate::{Assist, AssistCtx, AssistId}; | |||
16 | // Adds or changes existing visibility specifier. | 16 | // Adds or changes existing visibility specifier. |
17 | // | 17 | // |
18 | // ``` | 18 | // ``` |
19 | // fn<|> frobnicate() {} | 19 | // <|>fn frobnicate() {} |
20 | // ``` | 20 | // ``` |
21 | // -> | 21 | // -> |
22 | // ``` | 22 | // ``` |
diff --git a/crates/ra_assists/src/doc_tests/generated.rs b/crates/ra_assists/src/doc_tests/generated.rs index 493bd94d0..b96d5772e 100644 --- a/crates/ra_assists/src/doc_tests/generated.rs +++ b/crates/ra_assists/src/doc_tests/generated.rs | |||
@@ -146,7 +146,7 @@ fn doctest_change_visibility() { | |||
146 | check( | 146 | check( |
147 | "change_visibility", | 147 | "change_visibility", |
148 | r#####" | 148 | r#####" |
149 | fn<|> frobnicate() {} | 149 | <|>fn frobnicate() {} |
150 | "#####, | 150 | "#####, |
151 | r#####" | 151 | r#####" |
152 | pub(crate) fn frobnicate() {} | 152 | pub(crate) fn frobnicate() {} |
diff --git a/docs/user/assists.md b/docs/user/assists.md index 182f07e98..ee1cfa142 100644 --- a/docs/user/assists.md +++ b/docs/user/assists.md | |||
@@ -1,5 +1,8 @@ | |||
1 | # Assists | 1 | # Assists |
2 | 2 | ||
3 | Cursor position or selection is signified by `┃` character. | ||
4 | |||
5 | |||
3 | ## `add_derive` | 6 | ## `add_derive` |
4 | 7 | ||
5 | Adds a new `#[derive()]` clause to a struct or enum. | 8 | Adds a new `#[derive()]` clause to a struct or enum. |
@@ -8,7 +11,7 @@ Adds a new `#[derive()]` clause to a struct or enum. | |||
8 | // BEFORE | 11 | // BEFORE |
9 | struct Point { | 12 | struct Point { |
10 | x: u32, | 13 | x: u32, |
11 | y: u32,<|> | 14 | y: u32,┃ |
12 | } | 15 | } |
13 | 16 | ||
14 | // AFTER | 17 | // AFTER |
@@ -26,7 +29,7 @@ Specify type for a let binding. | |||
26 | ```rust | 29 | ```rust |
27 | // BEFORE | 30 | // BEFORE |
28 | fn main() { | 31 | fn main() { |
29 | let x<|> = 92; | 32 | let x┃ = 92; |
30 | } | 33 | } |
31 | 34 | ||
32 | // AFTER | 35 | // AFTER |
@@ -42,7 +45,7 @@ Adds a new inherent impl for a type. | |||
42 | ```rust | 45 | ```rust |
43 | // BEFORE | 46 | // BEFORE |
44 | struct Ctx<T: Clone> { | 47 | struct Ctx<T: Clone> { |
45 | data: T,<|> | 48 | data: T,┃ |
46 | } | 49 | } |
47 | 50 | ||
48 | // AFTER | 51 | // AFTER |
@@ -69,7 +72,7 @@ trait T { | |||
69 | 72 | ||
70 | impl T for () { | 73 | impl T for () { |
71 | Type X = (); | 74 | Type X = (); |
72 | fn foo(&self) {}<|> | 75 | fn foo(&self) {}┃ |
73 | 76 | ||
74 | } | 77 | } |
75 | 78 | ||
@@ -100,7 +103,7 @@ trait T { | |||
100 | fn bar(&self) {} | 103 | fn bar(&self) {} |
101 | } | 104 | } |
102 | 105 | ||
103 | impl T for () {<|> | 106 | impl T for () {┃ |
104 | 107 | ||
105 | } | 108 | } |
106 | 109 | ||
@@ -128,7 +131,7 @@ This means something of the form `!x` or `x != y`. | |||
128 | ```rust | 131 | ```rust |
129 | // BEFORE | 132 | // BEFORE |
130 | fn main() { | 133 | fn main() { |
131 | if x != 4 ||<|> !y {} | 134 | if x != 4 ||┃ !y {} |
132 | } | 135 | } |
133 | 136 | ||
134 | // AFTER | 137 | // AFTER |
@@ -143,7 +146,7 @@ Adds or changes existing visibility specifier. | |||
143 | 146 | ||
144 | ```rust | 147 | ```rust |
145 | // BEFORE | 148 | // BEFORE |
146 | fn<|> frobnicate() {} | 149 | ┃fn frobnicate() {} |
147 | 150 | ||
148 | // AFTER | 151 | // AFTER |
149 | pub(crate) fn frobnicate() {} | 152 | pub(crate) fn frobnicate() {} |
@@ -156,7 +159,7 @@ Replace a large conditional with a guarded return. | |||
156 | ```rust | 159 | ```rust |
157 | // BEFORE | 160 | // BEFORE |
158 | fn main() { | 161 | fn main() { |
159 | <|>if cond { | 162 | ┃if cond { |
160 | foo(); | 163 | foo(); |
161 | bar(); | 164 | bar(); |
162 | } | 165 | } |
@@ -182,7 +185,7 @@ enum Action { Move { distance: u32 }, Stop } | |||
182 | 185 | ||
183 | fn handle(action: Action) { | 186 | fn handle(action: Action) { |
184 | match action { | 187 | match action { |
185 | <|> | 188 | ┃ |
186 | } | 189 | } |
187 | } | 190 | } |
188 | 191 | ||
@@ -204,7 +207,7 @@ Flips operands of a binary expression. | |||
204 | ```rust | 207 | ```rust |
205 | // BEFORE | 208 | // BEFORE |
206 | fn main() { | 209 | fn main() { |
207 | let _ = 90 +<|> 2; | 210 | let _ = 90 +┃ 2; |
208 | } | 211 | } |
209 | 212 | ||
210 | // AFTER | 213 | // AFTER |
@@ -220,7 +223,7 @@ Flips two comma-separated items. | |||
220 | ```rust | 223 | ```rust |
221 | // BEFORE | 224 | // BEFORE |
222 | fn main() { | 225 | fn main() { |
223 | ((1, 2),<|> (3, 4)); | 226 | ((1, 2),┃ (3, 4)); |
224 | } | 227 | } |
225 | 228 | ||
226 | // AFTER | 229 | // AFTER |
@@ -236,7 +239,7 @@ Inlines local variable. | |||
236 | ```rust | 239 | ```rust |
237 | // BEFORE | 240 | // BEFORE |
238 | fn main() { | 241 | fn main() { |
239 | let x<|> = 1 + 2; | 242 | let x┃ = 1 + 2; |
240 | x * 4; | 243 | x * 4; |
241 | } | 244 | } |
242 | 245 | ||
@@ -253,7 +256,7 @@ Extracts subexpression into a variable. | |||
253 | ```rust | 256 | ```rust |
254 | // BEFORE | 257 | // BEFORE |
255 | fn main() { | 258 | fn main() { |
256 | <|>(1 + 2)<|> * 4; | 259 | ┃(1 + 2)┃ * 4; |
257 | } | 260 | } |
258 | 261 | ||
259 | // AFTER | 262 | // AFTER |
diff --git a/xtask/src/codegen/gen_assists_docs.rs b/xtask/src/codegen/gen_assists_docs.rs index 8dca2ed06..0c4cf2152 100644 --- a/xtask/src/codegen/gen_assists_docs.rs +++ b/xtask/src/codegen/gen_assists_docs.rs | |||
@@ -107,9 +107,13 @@ r#####" | |||
107 | } | 107 | } |
108 | 108 | ||
109 | fn generate_docs(assists: &[Assist], mode: Mode) -> Result<()> { | 109 | fn generate_docs(assists: &[Assist], mode: Mode) -> Result<()> { |
110 | let mut buf = String::from("# Assists\n"); | 110 | let mut buf = String::from( |
111 | "# Assists\n\nCursor position or selection is signified by `┃` character.\n\n", | ||
112 | ); | ||
111 | 113 | ||
112 | for assist in assists { | 114 | for assist in assists { |
115 | let before = assist.before.replace("<|>", "┃"); // Unicode pseudo-graphics bar | ||
116 | let after = assist.after.replace("<|>", "┃"); | ||
113 | let docs = format!( | 117 | let docs = format!( |
114 | " | 118 | " |
115 | ## `{}` | 119 | ## `{}` |
@@ -124,7 +128,7 @@ fn generate_docs(assists: &[Assist], mode: Mode) -> Result<()> { | |||
124 | {} | 128 | {} |
125 | ``` | 129 | ``` |
126 | ", | 130 | ", |
127 | assist.id, assist.doc, assist.before, assist.after | 131 | assist.id, assist.doc, before, after |
128 | ); | 132 | ); |
129 | buf.push_str(&docs); | 133 | buf.push_str(&docs); |
130 | } | 134 | } |