//! TODO kb move this into the complete_unqualified_path when starts to work properly
-use assists::utils::{insert_use, mod_path_to_ast, ImportScope, MergeBehaviour};
+use assists::utils::{insert_use, mod_path_to_ast, ImportScope};
use either::Either;
use hir::{db::HirDatabase, MacroDef, ModuleDef, Query};
use itertools::Itertools;
);
builder.replace(anchor.syntax().text_range(), correct_qualifier);
- // TODO kb: assists already have the merge behaviour setting, need to unite both
- // also consider a settings toggle for this particular feature?
- let rewriter =
- insert_use(&import_scope, mod_path_to_ast(&mod_path), Some(MergeBehaviour::Full));
+ let rewriter = insert_use(&import_scope, mod_path_to_ast(&mod_path), ctx.config.merge);
let old_ast = rewriter.rewrite_root()?;
algo::diff(&old_ast, &rewriter.rewrite(&old_ast)).into_text_edit(&mut builder);
//! module, and we use to statically check that we only produce snippet
//! completions if we are allowed to.
+use assists::utils::MergeBehaviour;
+
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CompletionConfig {
pub enable_postfix_completions: bool,
pub add_call_parenthesis: bool,
pub add_call_argument_snippets: bool,
pub snippet_cap: Option<SnippetCap>,
+ pub merge: Option<MergeBehaviour>,
}
impl CompletionConfig {
add_call_parenthesis: true,
add_call_argument_snippets: true,
snippet_cap: Some(SnippetCap { _private: () }),
+ merge: Some(MergeBehaviour::Full),
}
}
}