Skip to content

Commit 1ca5cb7

Browse files
committed
fix: also exclude 2 coloncolon in a row
1 parent e1de04d commit 1ca5cb7

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

crates/ide-completion/src/context.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,9 +581,14 @@ impl<'a> CompletionContext<'a> {
581581
return None;
582582
}
583583

584-
// has 3 colon in a row
584+
// has 3 colon or 2 coloncolon in a row
585585
// special casing this as per discussion in https://github.com/rust-lang/rust-analyzer/pull/13611#discussion_r1031845205
586-
if prev_token.prev_token().map(|t| t.kind() == T![:]).unwrap_or(false) {
586+
// and https://github.com/rust-lang/rust-analyzer/pull/13611#discussion_r1032812751
587+
if prev_token
588+
.prev_token()
589+
.map(|t| t.kind() == T![:] || t.kind() == T![::])
590+
.unwrap_or(false)
591+
{
587592
return None;
588593
}
589594
}

crates/ide-completion/src/tests/special.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,11 +967,17 @@ fn foo { crate:$0 }
967967
}
968968

969969
#[test]
970-
fn no_completions_in_after_tripple_colon() {
970+
fn no_completions_in_invalid_path() {
971971
check(
972972
r#"
973973
fn foo { crate:::$0 }
974974
"#,
975975
expect![""],
976976
);
977+
check(
978+
r#"
979+
fn foo { crate::::$0 }
980+
"#,
981+
expect![""],
982+
)
977983
}

0 commit comments

Comments
 (0)