aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src/render.rs
diff options
context:
space:
mode:
authorIgor Aleksanov <[email protected]>2020-11-01 09:59:43 +0000
committerIgor Aleksanov <[email protected]>2020-11-03 07:16:35 +0000
commit944ccf60758305a1b15224defe622cfca6939aaa (patch)
treed300280524b06d66d96d04df6bc882293c788707 /crates/completion/src/render.rs
parentfc8a1cd8006b021541ff673ec7f37a0f4b7bef57 (diff)
Add ConstRender
Diffstat (limited to 'crates/completion/src/render.rs')
-rw-r--r--crates/completion/src/render.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/completion/src/render.rs b/crates/completion/src/render.rs
index 66eb753b1..c614a7172 100644
--- a/crates/completion/src/render.rs
+++ b/crates/completion/src/render.rs
@@ -5,15 +5,17 @@ mod macro_;
5mod function; 5mod function;
6mod builder_ext; 6mod builder_ext;
7mod enum_variant; 7mod enum_variant;
8mod const_;
8 9
9use hir::HasAttrs; 10use hir::{Documentation, HasAttrs};
10use ide_db::RootDatabase; 11use ide_db::RootDatabase;
11use syntax::TextRange; 12use syntax::TextRange;
12 13
13use crate::{config::SnippetCap, CompletionContext}; 14use crate::{config::SnippetCap, CompletionContext};
14 15
15pub(crate) use crate::render::{ 16pub(crate) use crate::render::{
16 enum_variant::EnumVariantRender, function::FunctionRender, macro_::MacroRender, 17 const_::ConstRender, enum_variant::EnumVariantRender, function::FunctionRender,
18 macro_::MacroRender,
17}; 19};
18 20
19#[derive(Debug)] 21#[derive(Debug)]
@@ -41,6 +43,10 @@ impl<'a> RenderContext<'a> {
41 pub fn is_deprecated(&self, node: impl HasAttrs) -> bool { 43 pub fn is_deprecated(&self, node: impl HasAttrs) -> bool {
42 node.attrs(self.db()).by_key("deprecated").exists() 44 node.attrs(self.db()).by_key("deprecated").exists()
43 } 45 }
46
47 pub fn docs(&self, node: impl HasAttrs) -> Option<Documentation> {
48 node.docs(self.db())
49 }
44} 50}
45 51
46impl<'a> From<&'a CompletionContext<'a>> for RenderContext<'a> { 52impl<'a> From<&'a CompletionContext<'a>> for RenderContext<'a> {