mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Don't complete keywords in attributes inside expressions
This commit is contained in:
parent
2a48b53220
commit
2ac03ef1d6
2 changed files with 5 additions and 2 deletions
|
@ -786,13 +786,13 @@ mod tests {
|
||||||
at target_feature = "…"
|
at target_feature = "…"
|
||||||
at test
|
at test
|
||||||
at track_caller
|
at track_caller
|
||||||
kw return
|
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn complete_attribute_on_expr() {
|
fn complete_attribute_on_expr() {
|
||||||
|
cov_mark::check!(no_keyword_completion_in_attr_of_expr);
|
||||||
check(
|
check(
|
||||||
r#"fn main() { #[$0] foo() }"#,
|
r#"fn main() { #[$0] foo() }"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
|
@ -802,7 +802,6 @@ mod tests {
|
||||||
at deny(…)
|
at deny(…)
|
||||||
at forbid(…)
|
at forbid(…)
|
||||||
at warn(…)
|
at warn(…)
|
||||||
kw return
|
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,10 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
|
||||||
cov_mark::hit!(no_keyword_completion_in_record_lit);
|
cov_mark::hit!(no_keyword_completion_in_record_lit);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ctx.attribute_under_caret.is_some() {
|
||||||
|
cov_mark::hit!(no_keyword_completion_in_attr_of_expr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Suggest .await syntax for types that implement Future trait
|
// Suggest .await syntax for types that implement Future trait
|
||||||
if let Some(receiver) = ctx.dot_receiver() {
|
if let Some(receiver) = ctx.dot_receiver() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue