diff options
Diffstat (limited to 'crates/ide_completion/src/render.rs')
-rw-r--r-- | crates/ide_completion/src/render.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs index 750694432..7118183fe 100644 --- a/crates/ide_completion/src/render.rs +++ b/crates/ide_completion/src/render.rs | |||
@@ -18,6 +18,7 @@ use ide_db::{ | |||
18 | use syntax::TextRange; | 18 | use syntax::TextRange; |
19 | 19 | ||
20 | use crate::{ | 20 | use crate::{ |
21 | context::{PathCompletionContext, PathKind}, | ||
21 | item::{CompletionRelevanceTypeMatch, ImportEdit}, | 22 | item::{CompletionRelevanceTypeMatch, ImportEdit}, |
22 | render::{enum_variant::render_variant, function::render_fn, macro_::render_macro}, | 23 | render::{enum_variant::render_variant, function::render_fn, macro_::render_macro}, |
23 | CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, CompletionRelevance, | 24 | CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, CompletionRelevance, |
@@ -54,6 +55,9 @@ pub(crate) fn render_resolution_with_import<'a>( | |||
54 | import_edit: ImportEdit, | 55 | import_edit: ImportEdit, |
55 | ) -> Option<CompletionItem> { | 56 | ) -> Option<CompletionItem> { |
56 | let resolution = hir::ScopeDef::from(import_edit.import.original_item); | 57 | let resolution = hir::ScopeDef::from(import_edit.import.original_item); |
58 | if ctx.completion.expects_type() && resolution.is_value_def() { | ||
59 | return None; | ||
60 | } | ||
57 | let local_name = match resolution { | 61 | let local_name = match resolution { |
58 | hir::ScopeDef::ModuleDef(hir::ModuleDef::Function(f)) => f.name(ctx.completion.db), | 62 | hir::ScopeDef::ModuleDef(hir::ModuleDef::Function(f)) => f.name(ctx.completion.db), |
59 | hir::ScopeDef::ModuleDef(hir::ModuleDef::Const(c)) => c.name(ctx.completion.db)?, | 63 | hir::ScopeDef::ModuleDef(hir::ModuleDef::Const(c)) => c.name(ctx.completion.db)?, |
@@ -275,13 +279,10 @@ impl<'a> Render<'a> { | |||
275 | }; | 279 | }; |
276 | 280 | ||
277 | // Add `<>` for generic types | 281 | // Add `<>` for generic types |
278 | if self | 282 | if matches!( |
279 | .ctx | 283 | self.ctx.completion.path_context, |
280 | .completion | 284 | Some(PathCompletionContext { kind: Some(PathKind::Type), has_type_args: false, .. }) |
281 | .path_context | 285 | ) && self.ctx.completion.config.add_call_parenthesis |
282 | .as_ref() | ||
283 | .map_or(false, |it| it.is_path_type && !it.has_type_args) | ||
284 | && self.ctx.completion.config.add_call_parenthesis | ||
285 | { | 286 | { |
286 | if let Some(cap) = self.ctx.snippet_cap() { | 287 | if let Some(cap) = self.ctx.snippet_cap() { |
287 | let has_non_default_type_params = match resolution { | 288 | let has_non_default_type_params = match resolution { |