aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src/render/const_.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/completion/src/render/const_.rs')
-rw-r--r--crates/completion/src/render/const_.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/crates/completion/src/render/const_.rs b/crates/completion/src/render/const_.rs
index 3a1954211..039bdabc0 100644
--- a/crates/completion/src/render/const_.rs
+++ b/crates/completion/src/render/const_.rs
@@ -11,20 +11,27 @@ use crate::{
11 render::RenderContext, 11 render::RenderContext,
12}; 12};
13 13
14pub(crate) fn render_const<'a>(
15 ctx: RenderContext<'a>,
16 const_: hir::Const,
17) -> Option<CompletionItem> {
18 ConstRender::new(ctx, const_).render()
19}
20
14#[derive(Debug)] 21#[derive(Debug)]
15pub(crate) struct ConstRender<'a> { 22struct ConstRender<'a> {
16 ctx: RenderContext<'a>, 23 ctx: RenderContext<'a>,
17 const_: hir::Const, 24 const_: hir::Const,
18 ast_node: Const, 25 ast_node: Const,
19} 26}
20 27
21impl<'a> ConstRender<'a> { 28impl<'a> ConstRender<'a> {
22 pub(crate) fn new(ctx: RenderContext<'a>, const_: hir::Const) -> ConstRender<'a> { 29 fn new(ctx: RenderContext<'a>, const_: hir::Const) -> ConstRender<'a> {
23 let ast_node = const_.source(ctx.db()).value; 30 let ast_node = const_.source(ctx.db()).value;
24 ConstRender { ctx, const_, ast_node } 31 ConstRender { ctx, const_, ast_node }
25 } 32 }
26 33
27 pub(crate) fn render(self) -> Option<CompletionItem> { 34 fn render(self) -> Option<CompletionItem> {
28 let name = self.name()?; 35 let name = self.name()?;
29 let detail = self.detail(); 36 let detail = self.detail();
30 37