Add doc-comments to the new files
This commit is contained in:
@@ -23,11 +23,13 @@ pub(crate) use crate::render::{
|
|||||||
macro_::MacroRender, type_alias::TypeAliasRender,
|
macro_::MacroRender, type_alias::TypeAliasRender,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Generic renderer for completion items.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct Render<'a> {
|
pub(crate) struct Render<'a> {
|
||||||
ctx: RenderContext<'a>,
|
ctx: RenderContext<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Interface for data and methods required for items rendering.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct RenderContext<'a> {
|
pub(crate) struct RenderContext<'a> {
|
||||||
completion: &'a CompletionContext<'a>,
|
completion: &'a CompletionContext<'a>,
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
//! Renderer for `const` fields.
|
||||||
|
|
||||||
use hir::HasSource;
|
use hir::HasSource;
|
||||||
use syntax::{
|
use syntax::{
|
||||||
ast::{Const, NameOwner},
|
ast::{Const, NameOwner},
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
//! Renderer for `enum` variants.
|
||||||
|
|
||||||
use hir::{HasAttrs, HirDisplay, ModPath, StructKind};
|
use hir::{HasAttrs, HirDisplay, ModPath, StructKind};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use test_utils::mark;
|
use test_utils::mark;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
//! Renderer for function calls.
|
||||||
|
|
||||||
use hir::{HasSource, Type};
|
use hir::{HasSource, Type};
|
||||||
use syntax::{ast::Fn, display::function_declaration};
|
use syntax::{ast::Fn, display::function_declaration};
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
//! Renderer for macro invocations.
|
||||||
|
|
||||||
use hir::{Documentation, HasSource};
|
use hir::{Documentation, HasSource};
|
||||||
use syntax::display::macro_label;
|
use syntax::display::macro_label;
|
||||||
use test_utils::mark;
|
use test_utils::mark;
|
||||||
@@ -66,7 +68,11 @@ impl<'a> MacroRender<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn label(&self) -> String {
|
fn label(&self) -> String {
|
||||||
format!("{}!{}…{}", self.name, self.bra, self.ket)
|
if self.needs_bang() && self.ctx.snippet_cap().is_some() {
|
||||||
|
format!("{}!{}…{}", self.name, self.bra, self.ket)
|
||||||
|
} else {
|
||||||
|
self.banged_name()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn snippet(&self) -> String {
|
fn snippet(&self) -> String {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
//! Renderer for type aliases.
|
||||||
|
|
||||||
use hir::HasSource;
|
use hir::HasSource;
|
||||||
use syntax::{
|
use syntax::{
|
||||||
ast::{NameOwner, TypeAlias},
|
ast::{NameOwner, TypeAlias},
|
||||||
|
|||||||
Reference in New Issue
Block a user