diff --git a/crates/ra_assists/src/assists/change_visibility.rs b/crates/ra_assists/src/assists/change_visibility.rs index 88118cdf7c0..bed3436778d 100644 --- a/crates/ra_assists/src/assists/change_visibility.rs +++ b/crates/ra_assists/src/assists/change_visibility.rs @@ -16,7 +16,7 @@ // Adds or changes existing visibility specifier. // // ``` -// fn<|> frobnicate() {} +// <|>fn frobnicate() {} // ``` // -> // ``` diff --git a/crates/ra_assists/src/doc_tests/generated.rs b/crates/ra_assists/src/doc_tests/generated.rs index 493bd94d031..b96d5772e09 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() { check( "change_visibility", r#####" -fn<|> frobnicate() {} +<|>fn frobnicate() {} "#####, r#####" pub(crate) fn frobnicate() {} diff --git a/docs/user/assists.md b/docs/user/assists.md index 182f07e982d..ee1cfa142de 100644 --- a/docs/user/assists.md +++ b/docs/user/assists.md @@ -1,5 +1,8 @@ # Assists +Cursor position or selection is signified by `┃` character. + + ## `add_derive` Adds a new `#[derive()]` clause to a struct or enum. @@ -8,7 +11,7 @@ Adds a new `#[derive()]` clause to a struct or enum. // BEFORE struct Point { x: u32, - y: u32,<|> + y: u32,┃ } // AFTER @@ -26,7 +29,7 @@ Specify type for a let binding. ```rust // BEFORE fn main() { - let x<|> = 92; + let x┃ = 92; } // AFTER @@ -42,7 +45,7 @@ Adds a new inherent impl for a type. ```rust // BEFORE struct Ctx { - data: T,<|> + data: T,┃ } // AFTER @@ -69,7 +72,7 @@ trait T { impl T for () { Type X = (); - fn foo(&self) {}<|> + fn foo(&self) {}┃ } @@ -100,7 +103,7 @@ trait T { fn bar(&self) {} } -impl T for () {<|> +impl T for () {┃ } @@ -128,7 +131,7 @@ This means something of the form `!x` or `x != y`. ```rust // BEFORE fn main() { - if x != 4 ||<|> !y {} + if x != 4 ||┃ !y {} } // AFTER @@ -143,7 +146,7 @@ Adds or changes existing visibility specifier. ```rust // BEFORE -fn<|> frobnicate() {} +┃fn frobnicate() {} // AFTER pub(crate) fn frobnicate() {} @@ -156,7 +159,7 @@ Replace a large conditional with a guarded return. ```rust // BEFORE fn main() { - <|>if cond { + ┃if cond { foo(); bar(); } @@ -182,7 +185,7 @@ enum Action { Move { distance: u32 }, Stop } fn handle(action: Action) { match action { - <|> + ┃ } } @@ -204,7 +207,7 @@ Flips operands of a binary expression. ```rust // BEFORE fn main() { - let _ = 90 +<|> 2; + let _ = 90 +┃ 2; } // AFTER @@ -220,7 +223,7 @@ Flips two comma-separated items. ```rust // BEFORE fn main() { - ((1, 2),<|> (3, 4)); + ((1, 2),┃ (3, 4)); } // AFTER @@ -236,7 +239,7 @@ Inlines local variable. ```rust // BEFORE fn main() { - let x<|> = 1 + 2; + let x┃ = 1 + 2; x * 4; } @@ -253,7 +256,7 @@ Extracts subexpression into a variable. ```rust // BEFORE fn main() { - <|>(1 + 2)<|> * 4; + ┃(1 + 2)┃ * 4; } // AFTER diff --git a/xtask/src/codegen/gen_assists_docs.rs b/xtask/src/codegen/gen_assists_docs.rs index 8dca2ed06e3..0c4cf21529d 100644 --- a/xtask/src/codegen/gen_assists_docs.rs +++ b/xtask/src/codegen/gen_assists_docs.rs @@ -107,9 +107,13 @@ fn doctest_{}() {{ } fn generate_docs(assists: &[Assist], mode: Mode) -> Result<()> { - let mut buf = String::from("# Assists\n"); + let mut buf = String::from( + "# Assists\n\nCursor position or selection is signified by `┃` character.\n\n", + ); for assist in assists { + let before = assist.before.replace("<|>", "┃"); // Unicode pseudo-graphics bar + let after = assist.after.replace("<|>", "┃"); let docs = format!( " ## `{}` @@ -124,7 +128,7 @@ fn generate_docs(assists: &[Assist], mode: Mode) -> Result<()> { {} ``` ", - assist.id, assist.doc, assist.before, assist.after + assist.id, assist.doc, before, after ); buf.push_str(&docs); }