diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-07 13:17:28 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-07 13:17:28 +0100 |
commit | 8b6c3eaaeb6b074c7cbe34f25b7736157b13f84a (patch) | |
tree | 0fa5ba3bf62566d296441ccb414f294aa2cb343c /crates/ide_completion/src/render | |
parent | 5f7fc5ae68ff5debead06e377153e100b6e9951d (diff) | |
parent | 4eabcb2c01209065a231e616ba646ba63f68f00d (diff) |
Merge #9164
9164: internal: Reduce the number of direct fields in `CompletionContext` some more r=Veykril a=Veykril
Doesn't make the code much simpler yet.
bors r+
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide_completion/src/render')
-rw-r--r-- | crates/ide_completion/src/render/builder_ext.rs | 12 | ||||
-rw-r--r-- | crates/ide_completion/src/render/macro_.rs | 4 |
2 files changed, 10 insertions, 6 deletions
diff --git a/crates/ide_completion/src/render/builder_ext.rs b/crates/ide_completion/src/render/builder_ext.rs index 6d062b3b9..c54752d30 100644 --- a/crates/ide_completion/src/render/builder_ext.rs +++ b/crates/ide_completion/src/render/builder_ext.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use itertools::Itertools; | 3 | use itertools::Itertools; |
4 | 4 | ||
5 | use crate::{item::Builder, CompletionContext}; | 5 | use crate::{context::CallKind, item::Builder, patterns::ImmediateLocation, CompletionContext}; |
6 | 6 | ||
7 | #[derive(Debug)] | 7 | #[derive(Debug)] |
8 | pub(super) enum Params { | 8 | pub(super) enum Params { |
@@ -32,10 +32,12 @@ impl Builder { | |||
32 | cov_mark::hit!(no_parens_in_use_item); | 32 | cov_mark::hit!(no_parens_in_use_item); |
33 | return false; | 33 | return false; |
34 | } | 34 | } |
35 | if ctx.is_pattern_call { | 35 | if matches!(ctx.path_call_kind(), Some(CallKind::Expr) | Some(CallKind::Pat)) |
36 | return false; | 36 | | matches!( |
37 | } | 37 | ctx.completion_location, |
38 | if ctx.is_call { | 38 | Some(ImmediateLocation::MethodCall { has_parens: true, .. }) |
39 | ) | ||
40 | { | ||
39 | return false; | 41 | return false; |
40 | } | 42 | } |
41 | 43 | ||
diff --git a/crates/ide_completion/src/render/macro_.rs b/crates/ide_completion/src/render/macro_.rs index 0dfba8acc..429d937c8 100644 --- a/crates/ide_completion/src/render/macro_.rs +++ b/crates/ide_completion/src/render/macro_.rs | |||
@@ -5,6 +5,7 @@ use ide_db::SymbolKind; | |||
5 | use syntax::display::macro_label; | 5 | use syntax::display::macro_label; |
6 | 6 | ||
7 | use crate::{ | 7 | use crate::{ |
8 | context::CallKind, | ||
8 | item::{CompletionItem, CompletionKind, ImportEdit}, | 9 | item::{CompletionItem, CompletionKind, ImportEdit}, |
9 | render::RenderContext, | 10 | render::RenderContext, |
10 | }; | 11 | }; |
@@ -68,7 +69,8 @@ impl<'a> MacroRender<'a> { | |||
68 | } | 69 | } |
69 | 70 | ||
70 | fn needs_bang(&self) -> bool { | 71 | fn needs_bang(&self) -> bool { |
71 | self.ctx.completion.use_item_syntax.is_none() && !self.ctx.completion.is_macro_call | 72 | self.ctx.completion.use_item_syntax.is_none() |
73 | && !matches!(self.ctx.completion.path_call_kind(), Some(CallKind::Mac)) | ||
72 | } | 74 | } |
73 | 75 | ||
74 | fn label(&self) -> String { | 76 | fn label(&self) -> String { |