Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/context.rs')
-rw-r--r--crates/ide-completion/src/context.rs22
1 files changed, 3 insertions, 19 deletions
diff --git a/crates/ide-completion/src/context.rs b/crates/ide-completion/src/context.rs
index a0e1153f08..0e3b677f2d 100644
--- a/crates/ide-completion/src/context.rs
+++ b/crates/ide-completion/src/context.rs
@@ -581,7 +581,9 @@ impl<'a> CompletionContext<'a> {
return None;
}
- if !is_prev_token_valid_path_start_or_segment(&prev_token) {
+ // has 3 colon 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) {
return None;
}
}
@@ -637,24 +639,6 @@ impl<'a> CompletionContext<'a> {
}
}
-fn is_prev_token_valid_path_start_or_segment(token: &SyntaxToken) -> bool {
- if let Some(prev_token) = token.prev_token() {
- // token before coloncolon is invalid
- if !matches!(
- prev_token.kind(),
- // trival
- WHITESPACE | COMMENT
- // PathIdentSegment
- | IDENT | T![super] | T![self] | T![Self] | T![crate]
- // QualifiedPath
- | T![>]
- ) {
- return false;
- }
- }
- true
-}
-
const OP_TRAIT_LANG_NAMES: &[&str] = &[
"add_assign",
"add",