From 93bc009a5968c964693299263689b50b2efe9abc Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Fri, 4 Dec 2020 10:02:22 +0200 Subject: Remove the state --- crates/completion/src/item.rs | 30 +++--------------------------- crates/completion/src/lib.rs | 5 +---- 2 files changed, 4 insertions(+), 31 deletions(-) (limited to 'crates/completion/src') diff --git a/crates/completion/src/item.rs b/crates/completion/src/item.rs index dd25ca75c..2dadf7e5b 100644 --- a/crates/completion/src/item.rs +++ b/crates/completion/src/item.rs @@ -4,10 +4,10 @@ use std::fmt; use hir::{Documentation, ModPath, Mutability}; use ide_db::helpers::{ - insert_use::{self, ImportScope, ImportScopePtr, MergeBehaviour}, + insert_use::{self, ImportScope, MergeBehaviour}, mod_path_to_ast, }; -use syntax::{algo, SyntaxNode, TextRange}; +use syntax::{algo, TextRange}; use text_edit::TextEdit; use crate::config::SnippetCap; @@ -275,32 +275,8 @@ pub struct ImportEdit { pub merge_behaviour: Option, } -#[derive(Debug, Clone)] -pub struct ImportEditPtr { - pub import_path: ModPath, - pub import_scope: ImportScopePtr, - pub merge_behaviour: Option, -} - -impl ImportEditPtr { - pub fn into_import_edit(self, root: &SyntaxNode) -> Option { - Some(ImportEdit { - import_path: self.import_path, - import_scope: self.import_scope.into_scope(root)?, - merge_behaviour: self.merge_behaviour, - }) - } -} - impl ImportEdit { - pub fn get_edit_ptr(&self) -> ImportEditPtr { - ImportEditPtr { - import_path: self.import_path.clone(), - import_scope: self.import_scope.get_ptr(), - merge_behaviour: self.merge_behaviour, - } - } - + // TODO kb remove this at all now, since it's used only once? /// Attempts to insert the import to the given scope, producing a text edit. /// May return no edit in edge cases, such as scope already containing the import. pub fn to_text_edit(&self) -> Option { diff --git a/crates/completion/src/lib.rs b/crates/completion/src/lib.rs index c277cd466..c57203c80 100644 --- a/crates/completion/src/lib.rs +++ b/crates/completion/src/lib.rs @@ -18,10 +18,7 @@ use crate::{completions::Completions, context::CompletionContext, item::Completi pub use crate::{ config::{CompletionConfig, CompletionResolveCapability}, - item::{ - CompletionItem, CompletionItemKind, CompletionScore, ImportEdit, ImportEditPtr, - InsertTextFormat, - }, + item::{CompletionItem, CompletionItemKind, CompletionScore, ImportEdit, InsertTextFormat}, }; //FIXME: split the following feature into fine-grained features. -- cgit v1.2.3