mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-11-03 13:13:18 +00:00 
			
		
		
		
	fix: add semicolon completion to mod
This commit is contained in:
		
							parent
							
								
									4e1a3da8f2
								
							
						
					
					
						commit
						c7fefd5223
					
				
							
								
								
									
										
											BIN
										
									
								
								crates/ide-completion/src/completions/.mod_.rs.swp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								crates/ide-completion/src/completions/.mod_.rs.swp
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@ -53,6 +53,7 @@ pub(crate) fn complete_mod(
 | 
			
		||||
    let existing_mod_declarations = current_module
 | 
			
		||||
        .children(ctx.db)
 | 
			
		||||
        .filter_map(|module| Some(module.name(ctx.db)?.to_string()))
 | 
			
		||||
        .filter(|module| module != ctx.original_token.text())
 | 
			
		||||
        .collect::<FxHashSet<_>>();
 | 
			
		||||
 | 
			
		||||
    let module_declaration_file =
 | 
			
		||||
@ -351,4 +352,23 @@ fn ignored_bar() {}
 | 
			
		||||
            "#]],
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn semi_colon_completion() {
 | 
			
		||||
        check(
 | 
			
		||||
            r#"
 | 
			
		||||
//- /lib.rs
 | 
			
		||||
mod foo;
 | 
			
		||||
//- /foo.rs
 | 
			
		||||
mod bar {
 | 
			
		||||
    mod baz$0
 | 
			
		||||
}
 | 
			
		||||
//- /foo/bar/baz.rs
 | 
			
		||||
fn baz() {}
 | 
			
		||||
"#,
 | 
			
		||||
            expect![[r#"
 | 
			
		||||
                md baz;
 | 
			
		||||
            "#]],
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user