diff options
Diffstat (limited to 'crates/completion/src/lib.rs')
-rw-r--r-- | crates/completion/src/lib.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/crates/completion/src/lib.rs b/crates/completion/src/lib.rs index 3c7d5a46c..ee1b822e7 100644 --- a/crates/completion/src/lib.rs +++ b/crates/completion/src/lib.rs | |||
@@ -47,8 +47,8 @@ pub use crate::{ | |||
47 | // - `expr.while` -> `while expr {}` or `while let ... {}` for `Option` or `Result` | 47 | // - `expr.while` -> `while expr {}` or `while let ... {}` for `Option` or `Result` |
48 | // - `expr.ref` -> `&expr` | 48 | // - `expr.ref` -> `&expr` |
49 | // - `expr.refm` -> `&mut expr` | 49 | // - `expr.refm` -> `&mut expr` |
50 | // - `expr.let` -> `let <|> = expr;` | 50 | // - `expr.let` -> `let $0 = expr;` |
51 | // - `expr.letm` -> `let mut <|> = expr;` | 51 | // - `expr.letm` -> `let mut $0 = expr;` |
52 | // - `expr.not` -> `!expr` | 52 | // - `expr.not` -> `!expr` |
53 | // - `expr.dbg` -> `dbg!(expr)` | 53 | // - `expr.dbg` -> `dbg!(expr)` |
54 | // - `expr.dbgr` -> `dbg!(&expr)` | 54 | // - `expr.dbgr` -> `dbg!(&expr)` |
@@ -92,7 +92,7 @@ pub use crate::{ | |||
92 | /// ```no_run | 92 | /// ```no_run |
93 | /// fn f() { | 93 | /// fn f() { |
94 | /// let foo = 92; | 94 | /// let foo = 92; |
95 | /// let _ = bar<|> | 95 | /// let _ = bar$0 |
96 | /// } | 96 | /// } |
97 | /// ``` | 97 | /// ``` |
98 | /// | 98 | /// |
@@ -127,6 +127,7 @@ pub fn completions( | |||
127 | completions::macro_in_item_position::complete_macro_in_item_position(&mut acc, &ctx); | 127 | completions::macro_in_item_position::complete_macro_in_item_position(&mut acc, &ctx); |
128 | completions::trait_impl::complete_trait_impl(&mut acc, &ctx); | 128 | completions::trait_impl::complete_trait_impl(&mut acc, &ctx); |
129 | completions::mod_::complete_mod(&mut acc, &ctx); | 129 | completions::mod_::complete_mod(&mut acc, &ctx); |
130 | completions::flyimport::import_on_the_fly(&mut acc, &ctx); | ||
130 | 131 | ||
131 | Some(acc) | 132 | Some(acc) |
132 | } | 133 | } |
@@ -153,7 +154,9 @@ pub fn resolve_completion_edits( | |||
153 | }) | 154 | }) |
154 | .find(|mod_path| mod_path.to_string() == full_import_path)?; | 155 | .find(|mod_path| mod_path.to_string() == full_import_path)?; |
155 | 156 | ||
156 | ImportEdit { import_path, import_scope }.to_text_edit(config.merge).map(|edit| vec![edit]) | 157 | ImportEdit { import_path, import_scope } |
158 | .to_text_edit(config.insert_use.merge) | ||
159 | .map(|edit| vec![edit]) | ||
157 | } | 160 | } |
158 | 161 | ||
159 | #[cfg(test)] | 162 | #[cfg(test)] |
@@ -220,7 +223,7 @@ mod tests { | |||
220 | 223 | ||
221 | fn foo() { | 224 | fn foo() { |
222 | let bar = Bar; | 225 | let bar = Bar; |
223 | bar.fo<|>; | 226 | bar.fo$0; |
224 | } | 227 | } |
225 | "#, | 228 | "#, |
226 | DetailAndDocumentation { detail: "fn foo(&self)", documentation: "Do the foo" }, | 229 | DetailAndDocumentation { detail: "fn foo(&self)", documentation: "Do the foo" }, |
@@ -246,7 +249,7 @@ mod tests { | |||
246 | 249 | ||
247 | fn foo() { | 250 | fn foo() { |
248 | let bar = Bar; | 251 | let bar = Bar; |
249 | bar.fo<|>; | 252 | bar.fo$0; |
250 | } | 253 | } |
251 | "#, | 254 | "#, |
252 | DetailAndDocumentation { detail: "fn foo(&self)", documentation: " Do the foo" }, | 255 | DetailAndDocumentation { detail: "fn foo(&self)", documentation: " Do the foo" }, |
@@ -259,7 +262,7 @@ mod tests { | |||
259 | check_no_completion( | 262 | check_no_completion( |
260 | r#" | 263 | r#" |
261 | fn foo() { | 264 | fn foo() { |
262 | for i i<|> | 265 | for i i$0 |
263 | } | 266 | } |
264 | "#, | 267 | "#, |
265 | ); | 268 | ); |
@@ -270,7 +273,7 @@ mod tests { | |||
270 | fn foo() -> &'static str { "foo" } | 273 | fn foo() -> &'static str { "foo" } |
271 | 274 | ||
272 | fn bar() { | 275 | fn bar() { |
273 | for c in fo<|> | 276 | for c in fo$0 |
274 | } | 277 | } |
275 | "#, | 278 | "#, |
276 | DetailAndDocumentation { | 279 | DetailAndDocumentation { |