diff options
author | gfreezy <[email protected]> | 2019-01-20 04:02:00 +0000 |
---|---|---|
committer | gfreezy <[email protected]> | 2019-01-20 04:02:00 +0000 |
commit | 2a43638052213d1faa690e6d68bd5702e44fa027 (patch) | |
tree | 38cb979816dcdff9b9847592a1f99193f0bda70b /crates/ra_ide_api/src/completion/complete_keyword.rs | |
parent | 94d96b60f334e662f516bd0f04cc4191d7a804e6 (diff) |
use a combination of `source_change` and `text_edit` for `CompleteItem`
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_keyword.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_keyword.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_keyword.rs b/crates/ra_ide_api/src/completion/complete_keyword.rs index 006b20076..10ae01bc5 100644 --- a/crates/ra_ide_api/src/completion/complete_keyword.rs +++ b/crates/ra_ide_api/src/completion/complete_keyword.rs | |||
@@ -9,26 +9,26 @@ use crate::completion::{CompletionContext, CompletionItem, Completions, Completi | |||
9 | 9 | ||
10 | pub(super) fn complete_use_tree_keyword(acc: &mut Completions, ctx: &CompletionContext) { | 10 | pub(super) fn complete_use_tree_keyword(acc: &mut Completions, ctx: &CompletionContext) { |
11 | // complete keyword "crate" in use stmt | 11 | // complete keyword "crate" in use stmt |
12 | let leaf_range = ctx.leaf_range(); | 12 | let source_range = ctx.source_range(); |
13 | match (ctx.use_item_syntax.as_ref(), ctx.path_prefix.as_ref()) { | 13 | match (ctx.use_item_syntax.as_ref(), ctx.path_prefix.as_ref()) { |
14 | (Some(_), None) => { | 14 | (Some(_), None) => { |
15 | CompletionItem::new(CompletionKind::Keyword, leaf_range, "crate") | 15 | CompletionItem::new(CompletionKind::Keyword, source_range, "crate") |
16 | .kind(CompletionItemKind::Keyword) | 16 | .kind(CompletionItemKind::Keyword) |
17 | .insert_text("crate::") | 17 | .insert_text("crate::") |
18 | .add_to(acc); | 18 | .add_to(acc); |
19 | CompletionItem::new(CompletionKind::Keyword, leaf_range, "self") | 19 | CompletionItem::new(CompletionKind::Keyword, source_range, "self") |
20 | .kind(CompletionItemKind::Keyword) | 20 | .kind(CompletionItemKind::Keyword) |
21 | .add_to(acc); | 21 | .add_to(acc); |
22 | CompletionItem::new(CompletionKind::Keyword, leaf_range, "super") | 22 | CompletionItem::new(CompletionKind::Keyword, source_range, "super") |
23 | .kind(CompletionItemKind::Keyword) | 23 | .kind(CompletionItemKind::Keyword) |
24 | .insert_text("super::") | 24 | .insert_text("super::") |
25 | .add_to(acc); | 25 | .add_to(acc); |
26 | } | 26 | } |
27 | (Some(_), Some(_)) => { | 27 | (Some(_), Some(_)) => { |
28 | CompletionItem::new(CompletionKind::Keyword, leaf_range, "self") | 28 | CompletionItem::new(CompletionKind::Keyword, source_range, "self") |
29 | .kind(CompletionItemKind::Keyword) | 29 | .kind(CompletionItemKind::Keyword) |
30 | .add_to(acc); | 30 | .add_to(acc); |
31 | CompletionItem::new(CompletionKind::Keyword, leaf_range, "super") | 31 | CompletionItem::new(CompletionKind::Keyword, source_range, "super") |
32 | .kind(CompletionItemKind::Keyword) | 32 | .kind(CompletionItemKind::Keyword) |
33 | .insert_text("super::") | 33 | .insert_text("super::") |
34 | .add_to(acc); | 34 | .add_to(acc); |
@@ -38,7 +38,7 @@ pub(super) fn complete_use_tree_keyword(acc: &mut Completions, ctx: &CompletionC | |||
38 | } | 38 | } |
39 | 39 | ||
40 | fn keyword(ctx: &CompletionContext, kw: &str, snippet: &str) -> CompletionItem { | 40 | fn keyword(ctx: &CompletionContext, kw: &str, snippet: &str) -> CompletionItem { |
41 | CompletionItem::new(CompletionKind::Keyword, ctx.leaf_range(), kw) | 41 | CompletionItem::new(CompletionKind::Keyword, ctx.source_range(), kw) |
42 | .kind(CompletionItemKind::Keyword) | 42 | .kind(CompletionItemKind::Keyword) |
43 | .snippet(snippet) | 43 | .snippet(snippet) |
44 | .build() | 44 | .build() |