mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 11:20:54 +00:00
Merge pull request #19279 from Natural-selection1/master
Improve keyword completion for 'let' and 'let mut'
This commit is contained in:
commit
4552a3421f
@ -365,7 +365,8 @@ pub(crate) fn complete_expr_path(
|
||||
add_keyword("false", "false");
|
||||
|
||||
if in_condition || in_block_expr {
|
||||
add_keyword("let", "let");
|
||||
add_keyword("letm", "let mut $0");
|
||||
add_keyword("let", "let $0");
|
||||
}
|
||||
|
||||
if after_if_expr {
|
||||
|
@ -330,4 +330,34 @@ fn main() {
|
||||
",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn completes_let_with_space() {
|
||||
check_edit(
|
||||
"let",
|
||||
r#"
|
||||
fn main() {
|
||||
$0
|
||||
}
|
||||
"#,
|
||||
r#"
|
||||
fn main() {
|
||||
let $0
|
||||
}
|
||||
"#,
|
||||
);
|
||||
check_edit(
|
||||
"letm",
|
||||
r#"
|
||||
fn main() {
|
||||
$0
|
||||
}
|
||||
"#,
|
||||
r#"
|
||||
fn main() {
|
||||
let mut $0
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -170,6 +170,7 @@ impl Unit {
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -247,6 +248,7 @@ fn complete_in_block() {
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -297,6 +299,7 @@ fn complete_after_if_expr() {
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -370,6 +373,7 @@ fn completes_in_loop_ctx() {
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -942,6 +946,7 @@ fn foo() { if foo {} $0 }
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -983,6 +988,7 @@ fn foo() { if foo {} el$0 }
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -1072,6 +1078,7 @@ fn foo() { if foo {} $0 let x = 92; }
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -1113,6 +1120,7 @@ fn foo() { if foo {} el$0 let x = 92; }
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -1154,6 +1162,7 @@ fn foo() { if foo {} el$0 { let x = 92; } }
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -1205,6 +1214,7 @@ pub struct UnstableThisShouldNotBeListed;
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -1258,6 +1268,7 @@ pub struct UnstableButWeAreOnNightlyAnyway;
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -1495,6 +1506,7 @@ fn main() {
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -1945,6 +1957,7 @@ fn bar() {
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -2016,6 +2029,7 @@ fn foo() {
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
|
@ -285,6 +285,7 @@ fn bar() {
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
|
@ -1009,6 +1009,7 @@ fn here_we_go() {
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -1059,6 +1060,7 @@ fn here_we_go() {
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -1182,6 +1184,7 @@ fn bar() { qu$0 }
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
@ -1437,6 +1440,7 @@ fn foo() {
|
||||
kw if let
|
||||
kw impl
|
||||
kw let
|
||||
kw letm
|
||||
kw loop
|
||||
kw match
|
||||
kw mod
|
||||
|
Loading…
x
Reference in New Issue
Block a user