This commit is contained in:
hecatia-elegua 2023-03-29 14:58:33 +02:00
parent 53afac72d2
commit ba2b48d1b8
2 changed files with 4 additions and 7 deletions

View file

@ -243,10 +243,7 @@ impl Attrs {
} }
pub fn doc_aliases(&self) -> Vec<SmolStr> { pub fn doc_aliases(&self) -> Vec<SmolStr> {
self.doc_exprs() self.doc_exprs().into_iter().flat_map(|doc_expr| doc_expr.aliases()).collect()
.into_iter()
.flat_map(|doc_expr| doc_expr.aliases())
.collect()
} }
pub fn is_proc_macro(&self) -> bool { pub fn is_proc_macro(&self) -> bool {

View file

@ -17,7 +17,7 @@ use ide_db::{
}; };
use syntax::{ use syntax::{
ast::{self, AttrKind, NameOrNameRef}, ast::{self, AttrKind, NameOrNameRef},
AstNode, AstNode, SmolStr,
SyntaxKind::{self, *}, SyntaxKind::{self, *},
SyntaxToken, TextRange, TextSize, T, SyntaxToken, TextRange, TextSize, T,
}; };
@ -493,7 +493,7 @@ impl<'a> CompletionContext<'a> {
/// A version of [`SemanticsScope::process_all_names`] that filters out `#[doc(hidden)]` items and /// A version of [`SemanticsScope::process_all_names`] that filters out `#[doc(hidden)]` items and
/// passes all doc-aliases along, to funnel it into [`Completions::add_path_resolution`]. /// passes all doc-aliases along, to funnel it into [`Completions::add_path_resolution`].
pub(crate) fn process_all_names(&self, f: &mut dyn FnMut(Name, ScopeDef, Vec<syntax::SmolStr>)) { pub(crate) fn process_all_names(&self, f: &mut dyn FnMut(Name, ScopeDef, Vec<SmolStr>)) {
let _p = profile::span("CompletionContext::process_all_names"); let _p = profile::span("CompletionContext::process_all_names");
self.scope.process_all_names(&mut |name, def| { self.scope.process_all_names(&mut |name, def| {
if self.is_scope_def_hidden(def) { if self.is_scope_def_hidden(def) {
@ -547,7 +547,7 @@ impl<'a> CompletionContext<'a> {
self.krate != defining_crate && attrs.has_doc_hidden() self.krate != defining_crate && attrs.has_doc_hidden()
} }
fn doc_aliases(&self, scope_def: ScopeDef) -> Vec<syntax::SmolStr> { fn doc_aliases(&self, scope_def: ScopeDef) -> Vec<SmolStr> {
if let Some(attrs) = scope_def.attrs(self.db) { if let Some(attrs) = scope_def.attrs(self.db) {
attrs.doc_aliases() attrs.doc_aliases()
} else { } else {