pub(crate) mod snippet;
pub(crate) mod trait_impl;
pub(crate) mod unqualified_path;
+pub(crate) mod format_string;
use std::iter;
&mut self,
ctx: &CompletionContext,
local_name: hir::Name,
- resolution: &hir::ScopeDef,
+ resolution: hir::ScopeDef,
) {
- self.add_opt(render_resolution(RenderContext::new(ctx), local_name, resolution));
+ if ctx.is_scope_def_hidden(resolution) {
+ cov_mark::hit!(qualified_path_doc_hidden);
+ return;
+ }
+ self.add(render_resolution(RenderContext::new(ctx), local_name, resolution));
}
pub(crate) fn add_macro(
Some(it) => it,
None => return,
};
- self.add_opt(render_macro(RenderContext::new(ctx), None, name, macro_));
+ self.add(render_macro(RenderContext::new(ctx), None, name, macro_));
}
pub(crate) fn add_function(
func: hir::Function,
local_name: Option<hir::Name>,
) {
- self.add_opt(render_fn(RenderContext::new(ctx), None, local_name, func));
+ if !ctx.is_visible(&func) {
+ return;
+ }
+ self.add(render_fn(RenderContext::new(ctx), None, local_name, func));
}
pub(crate) fn add_method(
receiver: Option<hir::Name>,
local_name: Option<hir::Name>,
) {
- self.add_opt(render_method(RenderContext::new(ctx), None, receiver, local_name, func));
+ if !ctx.is_visible(&func) {
+ return;
+ }
+ self.add(render_method(RenderContext::new(ctx), None, receiver, local_name, func));
}
- pub(crate) fn add_const(&mut self, ctx: &CompletionContext, constant: hir::Const) {
- self.add_opt(render_const(RenderContext::new(ctx), constant));
+ pub(crate) fn add_const(&mut self, ctx: &CompletionContext, konst: hir::Const) {
+ if !ctx.is_visible(&konst) {
+ return;
+ }
+ self.add_opt(render_const(RenderContext::new(ctx), konst));
}
pub(crate) fn add_type_alias(&mut self, ctx: &CompletionContext, type_alias: hir::TypeAlias) {
+ if !ctx.is_visible(&type_alias) {
+ return;
+ }
self.add_opt(render_type_alias(RenderContext::new(ctx), type_alias));
}
field: hir::Field,
ty: &hir::Type,
) {
+ if !ctx.is_visible(&field) {
+ return;
+ }
let item = render_field(RenderContext::new(ctx), receiver, field, ty);
self.add(item);
}
&mut self,
ctx: &CompletionContext,
strukt: hir::Struct,
+ path: Option<hir::ModPath>,
local_name: Option<hir::Name>,
) {
- let item = render_struct_literal(RenderContext::new(ctx), strukt, local_name);
+ let item = render_struct_literal(RenderContext::new(ctx), strukt, path, local_name);
self.add_opt(item);
}