aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/completion')
-rw-r--r--crates/ra_ide_api/src/completion/complete_path.rs2
-rw-r--r--crates/ra_ide_api/src/completion/completion_context.rs2
-rw-r--r--crates/ra_ide_api/src/completion/completion_item.rs2
3 files changed, 4 insertions, 2 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs
index 0d7942496..3aef479d9 100644
--- a/crates/ra_ide_api/src/completion/complete_path.rs
+++ b/crates/ra_ide_api/src/completion/complete_path.rs
@@ -44,6 +44,8 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
44 } 44 }
45 _ => return, 45 _ => return,
46 }, 46 },
47
48 hir::ModuleDef::Function(_) => return,
47 }; 49 };
48} 50}
49 51
diff --git a/crates/ra_ide_api/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs
index ca2069e2a..578af6e5b 100644
--- a/crates/ra_ide_api/src/completion/completion_context.rs
+++ b/crates/ra_ide_api/src/completion/completion_context.rs
@@ -127,7 +127,7 @@ impl<'a> CompletionContext<'a> {
127 .ancestors() 127 .ancestors()
128 .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE) 128 .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE)
129 .find_map(ast::FnDef::cast); 129 .find_map(ast::FnDef::cast);
130 match (&self.module, self.function_syntax) { 130 match (self.module, self.function_syntax) {
131 (Some(module), Some(fn_def)) => { 131 (Some(module), Some(fn_def)) => {
132 let function = source_binder::function_from_module(self.db, module, fn_def); 132 let function = source_binder::function_from_module(self.db, module, fn_def);
133 self.function = Some(function); 133 self.function = Some(function);
diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs
index 5d6718a8d..5b2ba7e4a 100644
--- a/crates/ra_ide_api/src/completion/completion_item.rs
+++ b/crates/ra_ide_api/src/completion/completion_item.rs
@@ -219,6 +219,7 @@ impl Builder {
219 }; 219 };
220 let (kind, docs) = match def { 220 let (kind, docs) = match def {
221 hir::ModuleDef::Module(_) => (CompletionItemKind::Module, None), 221 hir::ModuleDef::Module(_) => (CompletionItemKind::Module, None),
222 hir::ModuleDef::Function(func) => return self.from_function(ctx, func),
222 hir::ModuleDef::Def(def_id) => match def_id.resolve(ctx.db) { 223 hir::ModuleDef::Def(def_id) => match def_id.resolve(ctx.db) {
223 hir::Def::Struct(it) => (CompletionItemKind::Struct, it.docs(ctx.db)), 224 hir::Def::Struct(it) => (CompletionItemKind::Struct, it.docs(ctx.db)),
224 hir::Def::Enum(it) => (CompletionItemKind::Enum, it.docs(ctx.db)), 225 hir::Def::Enum(it) => (CompletionItemKind::Enum, it.docs(ctx.db)),
@@ -226,7 +227,6 @@ impl Builder {
226 hir::Def::Type(it) => (CompletionItemKind::TypeAlias, it.docs(ctx.db)), 227 hir::Def::Type(it) => (CompletionItemKind::TypeAlias, it.docs(ctx.db)),
227 hir::Def::Const(it) => (CompletionItemKind::Const, it.docs(ctx.db)), 228 hir::Def::Const(it) => (CompletionItemKind::Const, it.docs(ctx.db)),
228 hir::Def::Static(it) => (CompletionItemKind::Static, it.docs(ctx.db)), 229 hir::Def::Static(it) => (CompletionItemKind::Static, it.docs(ctx.db)),
229 hir::Def::Function(function) => return self.from_function(ctx, function),
230 _ => return self, 230 _ => return self,
231 }, 231 },
232 }; 232 };