Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/item.rs')
| -rw-r--r-- | crates/ide-completion/src/item.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/crates/ide-completion/src/item.rs b/crates/ide-completion/src/item.rs index 5fb9dc93c9..c526c7f070 100644 --- a/crates/ide-completion/src/item.rs +++ b/crates/ide-completion/src/item.rs @@ -9,6 +9,7 @@ use ide_db::{ imports::import_assets::LocatedImport, }; use itertools::Itertools; +use macros::UpmapFromRaFixture; use smallvec::SmallVec; use stdx::{format_to, impl_from, never}; use syntax::{Edition, SmolStr, TextRange, TextSize, format_smolstr}; @@ -23,7 +24,7 @@ use crate::{ /// /// It is basically a POD with various properties. To construct a [`CompletionItem`], /// use [`Builder::new`] method and the [`Builder`] struct. -#[derive(Clone)] +#[derive(Clone, UpmapFromRaFixture)] #[non_exhaustive] pub struct CompletionItem { /// Label in the completion pop up which identifies completion. @@ -56,7 +57,8 @@ pub struct CompletionItem { /// Additional info to show in the UI pop up. pub detail: Option<String>, - pub documentation: Option<Documentation>, + // FIXME: Make this with `'db` lifetime. + pub documentation: Option<Documentation<'static>>, /// Whether this item is marked as deprecated pub deprecated: bool, @@ -487,7 +489,8 @@ pub(crate) struct Builder { insert_text: Option<String>, is_snippet: bool, detail: Option<String>, - documentation: Option<Documentation>, + // FIXME: Make this with `'db` lifetime. + documentation: Option<Documentation<'static>>, lookup: Option<SmolStr>, kind: CompletionItemKind, text_edit: Option<TextEdit>, @@ -643,11 +646,11 @@ impl Builder { self } #[allow(unused)] - pub(crate) fn documentation(&mut self, docs: Documentation) -> &mut Builder { + pub(crate) fn documentation(&mut self, docs: Documentation<'_>) -> &mut Builder { self.set_documentation(Some(docs)) } - pub(crate) fn set_documentation(&mut self, docs: Option<Documentation>) -> &mut Builder { - self.documentation = docs; + pub(crate) fn set_documentation(&mut self, docs: Option<Documentation<'_>>) -> &mut Builder { + self.documentation = docs.map(Documentation::into_owned); self } pub(crate) fn set_deprecated(&mut self, deprecated: bool) -> &mut Builder { |