mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
add ref postfix template
This commit is contained in:
parent
b85c189500
commit
434f1520df
2 changed files with 27 additions and 3 deletions
|
@ -30,6 +30,7 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
|
||||||
if let Some(dot_receiver) = ctx.dot_receiver {
|
if let Some(dot_receiver) = ctx.dot_receiver {
|
||||||
let receiver_text = dot_receiver.syntax().text().to_string();
|
let receiver_text = dot_receiver.syntax().text().to_string();
|
||||||
postfix_snippet(ctx, "not", &format!("!{}", receiver_text)).add_to(acc);
|
postfix_snippet(ctx, "not", &format!("!{}", receiver_text)).add_to(acc);
|
||||||
|
postfix_snippet(ctx, "ref", &format!("&{}", receiver_text)).add_to(acc);
|
||||||
postfix_snippet(ctx, "if", &format!("if {} {{$0}}", receiver_text)).add_to(acc);
|
postfix_snippet(ctx, "if", &format!("if {} {{$0}}", receiver_text)).add_to(acc);
|
||||||
postfix_snippet(
|
postfix_snippet(
|
||||||
ctx,
|
ctx,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
---
|
---
|
||||||
created: "2019-02-03T11:38:42.897384636+00:00"
|
created: "2019-02-14T17:12:57.412523988Z"
|
||||||
creator: insta@0.5.3
|
creator: insta@0.6.2
|
||||||
expression: kind_completions
|
|
||||||
source: crates/ra_ide_api/src/completion/completion_item.rs
|
source: crates/ra_ide_api/src/completion/completion_item.rs
|
||||||
|
expression: kind_completions
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
CompletionItem {
|
CompletionItem {
|
||||||
|
@ -97,6 +97,29 @@ source: crates/ra_ide_api/src/completion/completion_item.rs
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
CompletionItem {
|
||||||
|
completion_kind: Postfix,
|
||||||
|
label: "ref",
|
||||||
|
kind: None,
|
||||||
|
detail: None,
|
||||||
|
documentation: None,
|
||||||
|
lookup: None,
|
||||||
|
insert_text: Some(
|
||||||
|
"&bar"
|
||||||
|
),
|
||||||
|
insert_text_format: Snippet,
|
||||||
|
source_range: [76; 76),
|
||||||
|
text_edit: Some(
|
||||||
|
TextEdit {
|
||||||
|
atoms: [
|
||||||
|
AtomTextEdit {
|
||||||
|
delete: [72; 76),
|
||||||
|
insert: ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
CompletionItem {
|
CompletionItem {
|
||||||
completion_kind: Postfix,
|
completion_kind: Postfix,
|
||||||
label: "while",
|
label: "while",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue