aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_assists/src/handlers/add_custom_impl.rs2
-rw-r--r--crates/ra_assists/src/handlers/add_explicit_type.rs2
-rw-r--r--crates/ra_flycheck/src/lib.rs2
-rw-r--r--crates/ra_ide/src/lib.rs8
-rw-r--r--crates/ra_project_model/src/lib.rs2
-rw-r--r--crates/ra_syntax/src/validation.rs2
-rw-r--r--crates/ra_text_edit/src/lib.rs2
-rw-r--r--crates/rust-analyzer/src/cli.rs1
-rw-r--r--crates/rust-analyzer/src/cli/load_cargo.rs2
-rw-r--r--crates/rust-analyzer/src/main_loop/handlers.rs4
-rw-r--r--docs/user/features.md14
-rw-r--r--editors/code/package.json3
-rw-r--r--editors/code/src/commands/ssr.ts2
13 files changed, 28 insertions, 18 deletions
diff --git a/crates/ra_assists/src/handlers/add_custom_impl.rs b/crates/ra_assists/src/handlers/add_custom_impl.rs
index 795a225a4..2baeb8607 100644
--- a/crates/ra_assists/src/handlers/add_custom_impl.rs
+++ b/crates/ra_assists/src/handlers/add_custom_impl.rs
@@ -49,7 +49,7 @@ pub(crate) fn add_custom_impl(acc: &mut Assists, ctx: &AssistContext) -> Option<
49 let start_offset = annotated.syntax().parent()?.text_range().end(); 49 let start_offset = annotated.syntax().parent()?.text_range().end();
50 50
51 let label = 51 let label =
52 format!("Add custom impl '{}' for '{}'", trait_token.text().as_str(), annotated_name); 52 format!("Add custom impl `{}` for `{}`", trait_token.text().as_str(), annotated_name);
53 53
54 let target = attr.syntax().text_range(); 54 let target = attr.syntax().text_range();
55 acc.add(AssistId("add_custom_impl"), label, target, |edit| { 55 acc.add(AssistId("add_custom_impl"), label, target, |edit| {
diff --git a/crates/ra_assists/src/handlers/add_explicit_type.rs b/crates/ra_assists/src/handlers/add_explicit_type.rs
index 7ced00626..0c7d5e355 100644
--- a/crates/ra_assists/src/handlers/add_explicit_type.rs
+++ b/crates/ra_assists/src/handlers/add_explicit_type.rs
@@ -61,7 +61,7 @@ pub(crate) fn add_explicit_type(acc: &mut Assists, ctx: &AssistContext) -> Optio
61 let inferred_type = ty.display_source_code(ctx.db, module.into()).ok()?; 61 let inferred_type = ty.display_source_code(ctx.db, module.into()).ok()?;
62 acc.add( 62 acc.add(
63 AssistId("add_explicit_type"), 63 AssistId("add_explicit_type"),
64 format!("Insert explicit type '{}'", inferred_type), 64 format!("Insert explicit type `{}`", inferred_type),
65 pat_range, 65 pat_range,
66 |builder| match ascribed_ty { 66 |builder| match ascribed_ty {
67 Some(ascribed_ty) => { 67 Some(ascribed_ty) => {
diff --git a/crates/ra_flycheck/src/lib.rs b/crates/ra_flycheck/src/lib.rs
index 24af75c95..d5efb6ab3 100644
--- a/crates/ra_flycheck/src/lib.rs
+++ b/crates/ra_flycheck/src/lib.rs
@@ -157,7 +157,7 @@ impl FlycheckThread {
157 CheckEvent::Begin => { 157 CheckEvent::Begin => {
158 task_send 158 task_send
159 .send(CheckTask::Status(WorkDoneProgress::Begin(WorkDoneProgressBegin { 159 .send(CheckTask::Status(WorkDoneProgress::Begin(WorkDoneProgressBegin {
160 title: "Running 'cargo check'".to_string(), 160 title: "Running `cargo check`".to_string(),
161 cancellable: Some(false), 161 cancellable: Some(false),
162 message: None, 162 message: None,
163 percentage: None, 163 percentage: None,
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs
index 915199bd8..78149ddfc 100644
--- a/crates/ra_ide/src/lib.rs
+++ b/crates/ra_ide/src/lib.rs
@@ -176,14 +176,10 @@ impl AnalysisHost {
176 pub fn request_cancellation(&mut self) { 176 pub fn request_cancellation(&mut self) {
177 self.db.request_cancellation(); 177 self.db.request_cancellation();
178 } 178 }
179 pub fn raw_database( 179 pub fn raw_database(&self) -> &RootDatabase {
180 &self,
181 ) -> &(impl hir::db::HirDatabase + salsa::Database + ra_db::SourceDatabaseExt) {
182 &self.db 180 &self.db
183 } 181 }
184 pub fn raw_database_mut( 182 pub fn raw_database_mut(&mut self) -> &mut RootDatabase {
185 &mut self,
186 ) -> &mut (impl hir::db::HirDatabase + salsa::Database + ra_db::SourceDatabaseExt) {
187 &mut self.db 183 &mut self.db
188 } 184 }
189} 185}
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs
index 4f098b706..a2e9f65ef 100644
--- a/crates/ra_project_model/src/lib.rs
+++ b/crates/ra_project_model/src/lib.rs
@@ -35,7 +35,7 @@ pub enum ProjectWorkspace {
35/// `PackageRoot` describes a package root folder. 35/// `PackageRoot` describes a package root folder.
36/// Which may be an external dependency, or a member of 36/// Which may be an external dependency, or a member of
37/// the current workspace. 37/// the current workspace.
38#[derive(Clone)] 38#[derive(Debug, Clone)]
39pub struct PackageRoot { 39pub struct PackageRoot {
40 /// Path to the root folder 40 /// Path to the root folder
41 path: PathBuf, 41 path: PathBuf,
diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs
index e075cd801..d68cf0a82 100644
--- a/crates/ra_syntax/src/validation.rs
+++ b/crates/ra_syntax/src/validation.rs
@@ -54,7 +54,7 @@ fn rustc_unescape_error_to_string(err: unescape::EscapeError) -> &'static str {
54 "Unicode escape must not be empty" 54 "Unicode escape must not be empty"
55 } 55 }
56 EE::UnclosedUnicodeEscape => { 56 EE::UnclosedUnicodeEscape => {
57 "Missing '}' to terminate the unicode escape" 57 "Missing `}` to terminate the unicode escape"
58 } 58 }
59 EE::LeadingUnderscoreUnicodeEscape => { 59 EE::LeadingUnderscoreUnicodeEscape => {
60 "Unicode escape code must not begin with an underscore" 60 "Unicode escape code must not begin with an underscore"
diff --git a/crates/ra_text_edit/src/lib.rs b/crates/ra_text_edit/src/lib.rs
index 37f77cc47..c4f945101 100644
--- a/crates/ra_text_edit/src/lib.rs
+++ b/crates/ra_text_edit/src/lib.rs
@@ -21,7 +21,7 @@ pub struct TextEdit {
21 indels: Vec<Indel>, 21 indels: Vec<Indel>,
22} 22}
23 23
24#[derive(Debug, Default)] 24#[derive(Debug, Default, Clone)]
25pub struct TextEditBuilder { 25pub struct TextEditBuilder {
26 indels: Vec<Indel>, 26 indels: Vec<Indel>,
27} 27}
diff --git a/crates/rust-analyzer/src/cli.rs b/crates/rust-analyzer/src/cli.rs
index a865a7c7e..39ce77900 100644
--- a/crates/rust-analyzer/src/cli.rs
+++ b/crates/rust-analyzer/src/cli.rs
@@ -16,6 +16,7 @@ use ra_syntax::{AstNode, SourceFile};
16pub use analysis_bench::{analysis_bench, BenchWhat, Position}; 16pub use analysis_bench::{analysis_bench, BenchWhat, Position};
17pub use analysis_stats::analysis_stats; 17pub use analysis_stats::analysis_stats;
18pub use diagnostics::diagnostics; 18pub use diagnostics::diagnostics;
19pub use load_cargo::load_cargo;
19 20
20#[derive(Clone, Copy)] 21#[derive(Clone, Copy)]
21pub enum Verbosity { 22pub enum Verbosity {
diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs
index 023ced6cf..8eaf75ff6 100644
--- a/crates/rust-analyzer/src/cli/load_cargo.rs
+++ b/crates/rust-analyzer/src/cli/load_cargo.rs
@@ -22,7 +22,7 @@ fn vfs_root_to_id(r: ra_vfs::VfsRoot) -> SourceRootId {
22 SourceRootId(r.0) 22 SourceRootId(r.0)
23} 23}
24 24
25pub(crate) fn load_cargo( 25pub fn load_cargo(
26 root: &Path, 26 root: &Path,
27 load_out_dirs_from_check: bool, 27 load_out_dirs_from_check: bool,
28 with_proc_macro: bool, 28 with_proc_macro: bool,
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs
index be8688bc3..8d7baa14f 100644
--- a/crates/rust-analyzer/src/main_loop/handlers.rs
+++ b/crates/rust-analyzer/src/main_loop/handlers.rs
@@ -821,8 +821,8 @@ pub fn handle_code_lens(
821 // Gather runnables 821 // Gather runnables
822 for runnable in world.analysis().runnables(file_id)? { 822 for runnable in world.analysis().runnables(file_id)? {
823 let title = match &runnable.kind { 823 let title = match &runnable.kind {
824 RunnableKind::Test { .. } | RunnableKind::TestMod { .. } => "▶\u{fe0e}Run Test", 824 RunnableKind::Test { .. } | RunnableKind::TestMod { .. } => "▶\u{fe0e} Run Test",
825 RunnableKind::DocTest { .. } => "▶\u{fe0e}Run Doctest", 825 RunnableKind::DocTest { .. } => "▶\u{fe0e} Run Doctest",
826 RunnableKind::Bench { .. } => "Run Bench", 826 RunnableKind::Bench { .. } => "Run Bench",
827 RunnableKind::Bin => { 827 RunnableKind::Bin => {
828 // Do not suggest binary run on other target than binary 828 // Do not suggest binary run on other target than binary
diff --git a/docs/user/features.md b/docs/user/features.md
index b9a365fc1..340bce835 100644
--- a/docs/user/features.md
+++ b/docs/user/features.md
@@ -143,9 +143,9 @@ takes arguments, the cursor is positioned inside the parenthesis.
143There are postfix completions, which can be triggered by typing something like 143There are postfix completions, which can be triggered by typing something like
144`foo().if`. The word after `.` determines postfix completion. Possible variants are: 144`foo().if`. The word after `.` determines postfix completion. Possible variants are:
145 145
146- `expr.if` -> `if expr {}` 146- `expr.if` -> `if expr {}` or `if let ... {}` for `Option` or `Result`
147- `expr.match` -> `match expr {}` 147- `expr.match` -> `match expr {}`
148- `expr.while` -> `while expr {}` 148- `expr.while` -> `while expr {}` or `while let ... {}` for `Option` or `Result`
149- `expr.ref` -> `&expr` 149- `expr.ref` -> `&expr`
150- `expr.refm` -> `&mut expr` 150- `expr.refm` -> `&mut expr`
151- `expr.not` -> `!expr` 151- `expr.not` -> `!expr`
@@ -161,6 +161,16 @@ There also snippet completions:
161#### Inside Modules 161#### Inside Modules
162 162
163- `tfn` -> `#[test] fn f(){}` 163- `tfn` -> `#[test] fn f(){}`
164- `tmod` ->
165```rust
166#[cfg(test)]
167mod tests {
168 use super::*;
169
170 #[test]
171 fn test_fn() {}
172}
173```
164 174
165### Code Highlighting 175### Code Highlighting
166 176
diff --git a/editors/code/package.json b/editors/code/package.json
index 44cb0971e..b8a2182f0 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -623,6 +623,9 @@
623 ], 623 ],
624 "formatSpecifier": [ 624 "formatSpecifier": [
625 "punctuation.section.embedded.rust" 625 "punctuation.section.embedded.rust"
626 ],
627 "*.mutable": [
628 "markup.underline"
626 ] 629 ]
627 } 630 }
628 } 631 }
diff --git a/editors/code/src/commands/ssr.ts b/editors/code/src/commands/ssr.ts
index 6fee051fd..4ef8cdf04 100644
--- a/editors/code/src/commands/ssr.ts
+++ b/editors/code/src/commands/ssr.ts
@@ -11,7 +11,7 @@ export function ssr(ctx: Ctx): Cmd {
11 11
12 const options: vscode.InputBoxOptions = { 12 const options: vscode.InputBoxOptions = {
13 value: "() ==>> ()", 13 value: "() ==>> ()",
14 prompt: "EnteR request, for example 'Foo($a:expr) ==> Foo::new($a)' ", 14 prompt: "Enter request, for example 'Foo($a:expr) ==> Foo::new($a)' ",
15 validateInput: async (x: string) => { 15 validateInput: async (x: string) => {
16 try { 16 try {
17 await client.sendRequest(ra.ssr, { query: x, parseOnly: true }); 17 await client.sendRequest(ra.ssr, { query: x, parseOnly: true });