mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 21:43:37 +00:00
fix: also exclude 2 coloncolon in a row
This commit is contained in:
parent
e1de04d60c
commit
1ca5cb7ed9
2 changed files with 14 additions and 3 deletions
|
@ -581,9 +581,14 @@ impl<'a> CompletionContext<'a> {
|
|||
return None;
|
||||
}
|
||||
|
||||
// has 3 colon in a row
|
||||
// has 3 colon or 2 coloncolon in a row
|
||||
// special casing this as per discussion in https://github.com/rust-lang/rust-analyzer/pull/13611#discussion_r1031845205
|
||||
if prev_token.prev_token().map(|t| t.kind() == T![:]).unwrap_or(false) {
|
||||
// and https://github.com/rust-lang/rust-analyzer/pull/13611#discussion_r1032812751
|
||||
if prev_token
|
||||
.prev_token()
|
||||
.map(|t| t.kind() == T![:] || t.kind() == T![::])
|
||||
.unwrap_or(false)
|
||||
{
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -967,11 +967,17 @@ fn foo { crate:$0 }
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn no_completions_in_after_tripple_colon() {
|
||||
fn no_completions_in_invalid_path() {
|
||||
check(
|
||||
r#"
|
||||
fn foo { crate:::$0 }
|
||||
"#,
|
||||
expect![""],
|
||||
);
|
||||
check(
|
||||
r#"
|
||||
fn foo { crate::::$0 }
|
||||
"#,
|
||||
expect![""],
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue