aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/completion
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src/completion')
-rw-r--r--crates/ide/src/completion/completion_context.rs25
1 files changed, 23 insertions, 2 deletions
diff --git a/crates/ide/src/completion/completion_context.rs b/crates/ide/src/completion/completion_context.rs
index 47355d5dc..4d8b3670b 100644
--- a/crates/ide/src/completion/completion_context.rs
+++ b/crates/ide/src/completion/completion_context.rs
@@ -1,7 +1,7 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use base_db::SourceDatabase; 3use base_db::{FileLoader, SourceDatabase};
4use hir::{Semantics, SemanticsScope, Type}; 4use hir::{ModuleSource, Semantics, SemanticsScope, Type};
5use ide_db::RootDatabase; 5use ide_db::RootDatabase;
6use syntax::{ 6use syntax::{
7 algo::{find_covering_element, find_node_at_offset}, 7 algo::{find_covering_element, find_node_at_offset},
@@ -112,6 +112,27 @@ impl<'a> CompletionContext<'a> {
112 }; 112 };
113 let fake_ident_token = 113 let fake_ident_token =
114 file_with_fake_ident.syntax().token_at_offset(position.offset).right_biased().unwrap(); 114 file_with_fake_ident.syntax().token_at_offset(position.offset).right_biased().unwrap();
115 {
116 let module_names_for_import = sema
117 .to_module_def(position.file_id)
118 .and_then(|current_module| {
119 let definition_source = current_module.definition_source(db);
120 if !matches!(definition_source.value, ModuleSource::SourceFile(_)) {
121 return None;
122 }
123 let definition_source_file = definition_source.file_id.original_file(db);
124
125 // TODO kb for all possible candidates
126 let zz = db.list_some_random_files_todo(definition_source_file);
127 dbg!(zz);
128 // TODO kb exlude existing children from the candidates
129 let existing_children = current_module.children(db).collect::<Vec<_>>();
130 dbg!(existing_children);
131 None::<Vec<String>>
132 })
133 .unwrap_or_default();
134 dbg!(module_names_for_import);
135 };
115 136
116 let krate = sema.to_module_def(position.file_id).map(|m| m.krate()); 137 let krate = sema.to_module_def(position.file_id).map(|m| m.krate());
117 let original_token = 138 let original_token =