mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Add ConstRender
This commit is contained in:
parent
fc8a1cd800
commit
944ccf6075
5 changed files with 65 additions and 28 deletions
|
@ -5,15 +5,17 @@ mod macro_;
|
|||
mod function;
|
||||
mod builder_ext;
|
||||
mod enum_variant;
|
||||
mod const_;
|
||||
|
||||
use hir::HasAttrs;
|
||||
use hir::{Documentation, HasAttrs};
|
||||
use ide_db::RootDatabase;
|
||||
use syntax::TextRange;
|
||||
|
||||
use crate::{config::SnippetCap, CompletionContext};
|
||||
|
||||
pub(crate) use crate::render::{
|
||||
enum_variant::EnumVariantRender, function::FunctionRender, macro_::MacroRender,
|
||||
const_::ConstRender, enum_variant::EnumVariantRender, function::FunctionRender,
|
||||
macro_::MacroRender,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -41,6 +43,10 @@ impl<'a> RenderContext<'a> {
|
|||
pub fn is_deprecated(&self, node: impl HasAttrs) -> bool {
|
||||
node.attrs(self.db()).by_key("deprecated").exists()
|
||||
}
|
||||
|
||||
pub fn docs(&self, node: impl HasAttrs) -> Option<Documentation> {
|
||||
node.docs(self.db())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a CompletionContext<'a>> for RenderContext<'a> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue