aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src/render/enum_variant.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/completion/src/render/enum_variant.rs')
-rw-r--r--crates/completion/src/render/enum_variant.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/crates/completion/src/render/enum_variant.rs b/crates/completion/src/render/enum_variant.rs
index 64e742b77..f4bd02f25 100644
--- a/crates/completion/src/render/enum_variant.rs
+++ b/crates/completion/src/render/enum_variant.rs
@@ -1,24 +1,23 @@
1//! Renderer for `enum` variants. 1//! Renderer for `enum` variants.
2 2
3use assists::utils::{ImportScope, MergeBehaviour};
4use hir::{HasAttrs, HirDisplay, ModPath, StructKind}; 3use hir::{HasAttrs, HirDisplay, ModPath, StructKind};
5use itertools::Itertools; 4use itertools::Itertools;
6use test_utils::mark; 5use test_utils::mark;
7 6
8use crate::{ 7use crate::{
9 item::{CompletionItem, CompletionItemKind, CompletionKind}, 8 item::{CompletionItem, CompletionItemKind, CompletionKind, ImportToAdd},
10 render::{builder_ext::Params, RenderContext}, 9 render::{builder_ext::Params, RenderContext},
11}; 10};
12 11
13pub(crate) fn render_enum_variant<'a>( 12pub(crate) fn render_enum_variant<'a>(
14 ctx: RenderContext<'a>, 13 ctx: RenderContext<'a>,
15 import_data: Option<(ModPath, ImportScope, Option<MergeBehaviour>)>, 14 import_to_add: Option<ImportToAdd>,
16 local_name: Option<String>, 15 local_name: Option<String>,
17 variant: hir::EnumVariant, 16 variant: hir::EnumVariant,
18 path: Option<ModPath>, 17 path: Option<ModPath>,
19) -> CompletionItem { 18) -> CompletionItem {
20 let _p = profile::span("render_enum_variant"); 19 let _p = profile::span("render_enum_variant");
21 EnumVariantRender::new(ctx, local_name, variant, path).render(import_data) 20 EnumVariantRender::new(ctx, local_name, variant, path).render(import_to_add)
22} 21}
23 22
24#[derive(Debug)] 23#[derive(Debug)]
@@ -63,10 +62,7 @@ impl<'a> EnumVariantRender<'a> {
63 } 62 }
64 } 63 }
65 64
66 fn render( 65 fn render(self, import_to_add: Option<ImportToAdd>) -> CompletionItem {
67 self,
68 import_data: Option<(ModPath, ImportScope, Option<MergeBehaviour>)>,
69 ) -> CompletionItem {
70 let mut builder = CompletionItem::new( 66 let mut builder = CompletionItem::new(
71 CompletionKind::Reference, 67 CompletionKind::Reference,
72 self.ctx.source_range(), 68 self.ctx.source_range(),
@@ -75,7 +71,7 @@ impl<'a> EnumVariantRender<'a> {
75 .kind(CompletionItemKind::EnumVariant) 71 .kind(CompletionItemKind::EnumVariant)
76 .set_documentation(self.variant.docs(self.ctx.db())) 72 .set_documentation(self.variant.docs(self.ctx.db()))
77 .set_deprecated(self.ctx.is_deprecated(self.variant)) 73 .set_deprecated(self.ctx.is_deprecated(self.variant))
78 .import_data(import_data) 74 .add_import(import_to_add)
79 .detail(self.detail()); 75 .detail(self.detail());
80 76
81 if self.variant_kind == StructKind::Tuple { 77 if self.variant_kind == StructKind::Tuple {