diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs index 825fae587b1..a84f0b334b5 100644 --- a/crates/ide_completion/src/completions/unqualified_path.rs +++ b/crates/ide_completion/src/completions/unqualified_path.rs @@ -6,6 +6,7 @@ use crate::{patterns::ImmediateLocation, CompletionContext, Completions}; pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionContext) { + let _p = profile::span("complete_unqualified_path"); if ctx.is_path_disallowed() || !ctx.is_trivial_path() || ctx.has_impl_or_trait_prev_sibling() { return; } diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs index ac01968126d..3f40260d33c 100644 --- a/crates/ide_completion/src/context.rs +++ b/crates/ide_completion/src/context.rs @@ -353,6 +353,7 @@ pub(super) fn new( position: FilePosition, config: &'a CompletionConfig, ) -> Option> { + let _p = profile::span("CompletionContext::new"); let sema = Semantics::new(db); let original_file = sema.parse(position.file_id); diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs index 5ae52f3cc91..a1d4eb998fa 100644 --- a/crates/ide_completion/src/render.rs +++ b/crates/ide_completion/src/render.rs @@ -16,7 +16,7 @@ helpers::{item_name, SnippetCap}, RootDatabase, SymbolKind, }; -use syntax::{SyntaxKind, TextRange}; +use syntax::{SmolStr, SyntaxKind, TextRange}; use crate::{ context::{PathCompletionContext, PathKind}, @@ -243,7 +243,7 @@ fn render_resolution_( if has_non_default_type_params { cov_mark::hit!(inserts_angle_brackets_for_generics); item.lookup_by(local_name.clone()) - .label(format!("{}<…>", local_name)) + .label(SmolStr::from_iter([&local_name, "<…>"])) .insert_snippet(cap, format!("{}<$0>", local_name)); } } diff --git a/crates/ide_completion/src/render/const_.rs b/crates/ide_completion/src/render/const_.rs index 707b6533b54..c40490ac0b8 100644 --- a/crates/ide_completion/src/render/const_.rs +++ b/crates/ide_completion/src/render/const_.rs @@ -7,6 +7,7 @@ use crate::{item::CompletionItem, render::RenderContext}; pub(crate) fn render_const(ctx: RenderContext<'_>, const_: hir::Const) -> Option { + let _p = profile::span("render_const"); ConstRender::new(ctx, const_)?.render() } diff --git a/crates/ide_completion/src/render/macro_.rs b/crates/ide_completion/src/render/macro_.rs index 1f76583adbb..090bb5a7151 100644 --- a/crates/ide_completion/src/render/macro_.rs +++ b/crates/ide_completion/src/render/macro_.rs @@ -40,7 +40,7 @@ fn new(ctx: RenderContext<'a>, name: hir::Name, macro_: hir::MacroDef) -> MacroR MacroRender { ctx, name, macro_, docs, bra, ket } } - fn render(&self, import_to_add: Option) -> Option { + fn render(self, import_to_add: Option) -> Option { let source_range = if self.ctx.completion.is_immediately_after_macro_bang() { cov_mark::hit!(completes_macro_call_if_cursor_at_bang_token); self.ctx.completion.token.parent().map(|it| it.text_range()) @@ -48,9 +48,7 @@ fn render(&self, import_to_add: Option) -> Option { Some(self.ctx.source_range()) }?; let mut item = CompletionItem::new(SymbolKind::Macro, source_range, self.label()); - item.set_documentation(self.docs.clone()) - .set_deprecated(self.ctx.is_deprecated(self.macro_)) - .set_detail(self.detail()); + item.set_deprecated(self.ctx.is_deprecated(self.macro_)).set_detail(self.detail()); if let Some(import_to_add) = import_to_add { item.add_import(import_to_add); @@ -76,6 +74,7 @@ fn render(&self, import_to_add: Option) -> Option { } }; + item.set_documentation(self.docs); Some(item.build()) } diff --git a/crates/ide_completion/src/render/type_alias.rs b/crates/ide_completion/src/render/type_alias.rs index 6e6c1204b2b..259fe25a6cd 100644 --- a/crates/ide_completion/src/render/type_alias.rs +++ b/crates/ide_completion/src/render/type_alias.rs @@ -13,6 +13,7 @@ pub(crate) fn render_type_alias( ctx: RenderContext<'_>, type_alias: hir::TypeAlias, ) -> Option { + let _p = profile::span("render_type_alias"); TypeAliasRender::new(ctx, type_alias)?.render(false) } @@ -20,6 +21,7 @@ pub(crate) fn render_type_alias_with_eq( ctx: RenderContext<'_>, type_alias: hir::TypeAlias, ) -> Option { + let _p = profile::span("render_type_alias_with_eq"); TypeAliasRender::new(ctx, type_alias)?.render(true) }