File tree 1 file changed +6
-7
lines changed
crates/ide-completion/src/completions
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -17,13 +17,12 @@ use crate::{
17
17
/// Complete mod declaration, i.e. `mod $0;`
18
18
pub ( crate ) fn complete_mod ( acc : & mut Completions , ctx : & CompletionContext ) -> Option < ( ) > {
19
19
let mod_under_caret = match ctx. name_ctx ( ) {
20
- Some ( NameContext { kind : NameKind :: Module ( mod_under_caret) , .. } )
21
- if mod_under_caret. item_list ( ) . is_none ( ) =>
22
- {
23
- mod_under_caret
24
- }
20
+ Some ( NameContext { kind : NameKind :: Module ( mod_under_caret) , .. } ) => mod_under_caret,
25
21
_ => return None ,
26
22
} ;
23
+ if mod_under_caret. item_list ( ) . is_some ( ) {
24
+ return None ;
25
+ }
27
26
28
27
let _p = profile:: span ( "completion::complete_mod" ) ;
29
28
@@ -32,8 +31,8 @@ pub(crate) fn complete_mod(acc: &mut Completions, ctx: &CompletionContext) -> Op
32
31
// interested in its parent.
33
32
if ctx. original_token . kind ( ) == SyntaxKind :: IDENT {
34
33
if let Some ( module) = ctx. original_token . ancestors ( ) . nth ( 1 ) . and_then ( ast:: Module :: cast) {
35
- match current_module . definition_source ( ctx. db ) . value {
36
- ModuleSource :: Module ( src ) if src == module => {
34
+ match ctx. sema . to_def ( & module ) {
35
+ Some ( module ) if module == current_module => {
37
36
if let Some ( parent) = current_module. parent ( ctx. db ) {
38
37
current_module = parent;
39
38
}
You can’t perform that action at this time.
0 commit comments