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> {
581581 return None ;
582582 }
583583
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 ) {
585587 return None ;
586588 }
587589 }
@@ -637,24 +639,6 @@ impl<'a> CompletionContext<'a> {
637639 }
638640}
639641
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-
658642const OP_TRAIT_LANG_NAMES : & [ & str ] = & [
659643 "add_assign" ,
660644 "add" ,
Original file line number Diff line number Diff line change @@ -967,16 +967,10 @@ fn foo { crate:$0 }
967967}
968968
969969#[ test]
970- fn no_completions_in_invalid_path ( ) {
970+ fn no_completions_in_after_tripple_colon ( ) {
971971 check (
972972 r#"
973973fn foo { crate:::$0 }
974- "# ,
975- expect ! [ "" ] ,
976- ) ;
977- check (
978- r#"
979- fn foo { crate::::$0 }
980974"# ,
981975 expect ! [ "" ] ,
982976 ) ;
You can’t perform that action at this time.
0 commit comments