Add doc-comments to the new files

This commit is contained in:
Igor Aleksanov 2020-11-01 13:48:42 +03:00
parent af7175f332
commit 2a214e15d3
6 changed files with 17 additions and 1 deletions

View File

@ -23,11 +23,13 @@ pub(crate) use crate::render::{
macro_::MacroRender, type_alias::TypeAliasRender,
};
/// Generic renderer for completion items.
#[derive(Debug)]
pub(crate) struct Render<'a> {
ctx: RenderContext<'a>,
}
/// Interface for data and methods required for items rendering.
#[derive(Debug)]
pub(crate) struct RenderContext<'a> {
completion: &'a CompletionContext<'a>,

View File

@ -1,3 +1,5 @@
//! Renderer for `const` fields.
use hir::HasSource;
use syntax::{
ast::{Const, NameOwner},

View File

@ -1,3 +1,5 @@
//! Renderer for `enum` variants.
use hir::{HasAttrs, HirDisplay, ModPath, StructKind};
use itertools::Itertools;
use test_utils::mark;

View File

@ -1,3 +1,5 @@
//! Renderer for function calls.
use hir::{HasSource, Type};
use syntax::{ast::Fn, display::function_declaration};

View File

@ -1,3 +1,5 @@
//! Renderer for macro invocations.
use hir::{Documentation, HasSource};
use syntax::display::macro_label;
use test_utils::mark;
@ -66,7 +68,11 @@ impl<'a> MacroRender<'a> {
}
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 {

View File

@ -1,3 +1,5 @@
//! Renderer for type aliases.
use hir::HasSource;
use syntax::{
ast::{NameOwner, TypeAlias},