diff options
Diffstat (limited to 'crates/completion')
-rw-r--r-- | crates/completion/src/render.rs | 2 | ||||
-rw-r--r-- | crates/completion/src/render/const_.rs | 2 | ||||
-rw-r--r-- | crates/completion/src/render/enum_variant.rs | 2 | ||||
-rw-r--r-- | crates/completion/src/render/function.rs | 2 | ||||
-rw-r--r-- | crates/completion/src/render/macro_.rs | 8 | ||||
-rw-r--r-- | crates/completion/src/render/type_alias.rs | 2 |
6 files changed, 17 insertions, 1 deletions
diff --git a/crates/completion/src/render.rs b/crates/completion/src/render.rs index d78877421..dd9edc514 100644 --- a/crates/completion/src/render.rs +++ b/crates/completion/src/render.rs | |||
@@ -23,11 +23,13 @@ pub(crate) use crate::render::{ | |||
23 | macro_::MacroRender, type_alias::TypeAliasRender, | 23 | macro_::MacroRender, type_alias::TypeAliasRender, |
24 | }; | 24 | }; |
25 | 25 | ||
26 | /// Generic renderer for completion items. | ||
26 | #[derive(Debug)] | 27 | #[derive(Debug)] |
27 | pub(crate) struct Render<'a> { | 28 | pub(crate) struct Render<'a> { |
28 | ctx: RenderContext<'a>, | 29 | ctx: RenderContext<'a>, |
29 | } | 30 | } |
30 | 31 | ||
32 | /// Interface for data and methods required for items rendering. | ||
31 | #[derive(Debug)] | 33 | #[derive(Debug)] |
32 | pub(crate) struct RenderContext<'a> { | 34 | pub(crate) struct RenderContext<'a> { |
33 | completion: &'a CompletionContext<'a>, | 35 | completion: &'a CompletionContext<'a>, |
diff --git a/crates/completion/src/render/const_.rs b/crates/completion/src/render/const_.rs index 829eb574d..3a1954211 100644 --- a/crates/completion/src/render/const_.rs +++ b/crates/completion/src/render/const_.rs | |||
@@ -1,3 +1,5 @@ | |||
1 | //! Renderer for `const` fields. | ||
2 | |||
1 | use hir::HasSource; | 3 | use hir::HasSource; |
2 | use syntax::{ | 4 | use syntax::{ |
3 | ast::{Const, NameOwner}, | 5 | ast::{Const, NameOwner}, |
diff --git a/crates/completion/src/render/enum_variant.rs b/crates/completion/src/render/enum_variant.rs index bc96cc303..f8b151318 100644 --- a/crates/completion/src/render/enum_variant.rs +++ b/crates/completion/src/render/enum_variant.rs | |||
@@ -1,3 +1,5 @@ | |||
1 | //! Renderer for `enum` variants. | ||
2 | |||
1 | use hir::{HasAttrs, HirDisplay, ModPath, StructKind}; | 3 | use hir::{HasAttrs, HirDisplay, ModPath, StructKind}; |
2 | use itertools::Itertools; | 4 | use itertools::Itertools; |
3 | use test_utils::mark; | 5 | use test_utils::mark; |
diff --git a/crates/completion/src/render/function.rs b/crates/completion/src/render/function.rs index cf3852bf6..9d9bbe309 100644 --- a/crates/completion/src/render/function.rs +++ b/crates/completion/src/render/function.rs | |||
@@ -1,3 +1,5 @@ | |||
1 | //! Renderer for function calls. | ||
2 | |||
1 | use hir::{HasSource, Type}; | 3 | use hir::{HasSource, Type}; |
2 | use syntax::{ast::Fn, display::function_declaration}; | 4 | use syntax::{ast::Fn, display::function_declaration}; |
3 | 5 | ||
diff --git a/crates/completion/src/render/macro_.rs b/crates/completion/src/render/macro_.rs index 6df121c66..066185559 100644 --- a/crates/completion/src/render/macro_.rs +++ b/crates/completion/src/render/macro_.rs | |||
@@ -1,3 +1,5 @@ | |||
1 | //! Renderer for macro invocations. | ||
2 | |||
1 | use hir::{Documentation, HasSource}; | 3 | use hir::{Documentation, HasSource}; |
2 | use syntax::display::macro_label; | 4 | use syntax::display::macro_label; |
3 | use test_utils::mark; | 5 | use test_utils::mark; |
@@ -66,7 +68,11 @@ impl<'a> MacroRender<'a> { | |||
66 | } | 68 | } |
67 | 69 | ||
68 | fn label(&self) -> String { | 70 | fn label(&self) -> String { |
69 | format!("{}!{}…{}", self.name, self.bra, self.ket) | 71 | if self.needs_bang() && self.ctx.snippet_cap().is_some() { |
72 | format!("{}!{}…{}", self.name, self.bra, self.ket) | ||
73 | } else { | ||
74 | self.banged_name() | ||
75 | } | ||
70 | } | 76 | } |
71 | 77 | ||
72 | fn snippet(&self) -> String { | 78 | fn snippet(&self) -> String { |
diff --git a/crates/completion/src/render/type_alias.rs b/crates/completion/src/render/type_alias.rs index 378aa8c67..50a6d06c2 100644 --- a/crates/completion/src/render/type_alias.rs +++ b/crates/completion/src/render/type_alias.rs | |||
@@ -1,3 +1,5 @@ | |||
1 | //! Renderer for type aliases. | ||
2 | |||
1 | use hir::HasSource; | 3 | use hir::HasSource; |
2 | use syntax::{ | 4 | use syntax::{ |
3 | ast::{NameOwner, TypeAlias}, | 5 | ast::{NameOwner, TypeAlias}, |