This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +4
-26
lines changed
crates/ide-completion/src Expand file tree Collapse file tree 2 files changed +4
-26
lines changed Original file line number Diff line number Diff line change @@ -581,7 +581,9 @@ impl<'a> CompletionContext<'a> {
581
581
return None ;
582
582
}
583
583
584
- if !is_prev_token_valid_path_start_or_segment ( & prev_token) {
584
+ // has 3 colon in a row
585
+ // 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 ) {
585
587
return None ;
586
588
}
587
589
}
@@ -637,24 +639,6 @@ impl<'a> CompletionContext<'a> {
637
639
}
638
640
}
639
641
640
- fn is_prev_token_valid_path_start_or_segment ( token : & SyntaxToken ) -> bool {
641
- if let Some ( prev_token) = token. prev_token ( ) {
642
- // token before coloncolon is invalid
643
- if !matches ! (
644
- prev_token. kind( ) ,
645
- // trival
646
- WHITESPACE | COMMENT
647
- // PathIdentSegment
648
- | IDENT | T ![ super ] | T ![ self ] | T ![ Self ] | T ![ crate ]
649
- // QualifiedPath
650
- | T ![ >]
651
- ) {
652
- return false ;
653
- }
654
- }
655
- true
656
- }
657
-
658
642
const OP_TRAIT_LANG_NAMES : & [ & str ] = & [
659
643
"add_assign" ,
660
644
"add" ,
Original file line number Diff line number Diff line change @@ -967,16 +967,10 @@ fn foo { crate:$0 }
967
967
}
968
968
969
969
#[ test]
970
- fn no_completions_in_invalid_path ( ) {
970
+ fn no_completions_in_after_tripple_colon ( ) {
971
971
check (
972
972
r#"
973
973
fn foo { crate:::$0 }
974
- "# ,
975
- expect ! [ "" ] ,
976
- ) ;
977
- check (
978
- r#"
979
- fn foo { crate::::$0 }
980
974
"# ,
981
975
expect ! [ "" ] ,
982
976
) ;
You can’t perform that action at this time.
0 commit comments