diff options
Diffstat (limited to 'crates/completion')
-rw-r--r-- | crates/completion/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/completion/src/completions/record.rs | 4 | ||||
-rw-r--r-- | crates/completion/src/completions/unqualified_path.rs | 2 | ||||
-rw-r--r-- | crates/completion/src/config.rs | 2 | ||||
-rw-r--r-- | crates/completion/src/item.rs | 7 | ||||
-rw-r--r-- | crates/completion/src/render.rs | 2 | ||||
-rw-r--r-- | crates/completion/src/render/enum_variant.rs | 2 | ||||
-rw-r--r-- | crates/completion/src/render/function.rs | 2 | ||||
-rw-r--r-- | crates/completion/src/render/macro_.rs | 3 |
9 files changed, 15 insertions, 11 deletions
diff --git a/crates/completion/Cargo.toml b/crates/completion/Cargo.toml index e7df9d955..102de33f8 100644 --- a/crates/completion/Cargo.toml +++ b/crates/completion/Cargo.toml | |||
@@ -15,7 +15,6 @@ log = "0.4.8" | |||
15 | rustc-hash = "1.1.0" | 15 | rustc-hash = "1.1.0" |
16 | either = "1.6.1" | 16 | either = "1.6.1" |
17 | 17 | ||
18 | assists = { path = "../assists", version = "0.0.0" } | ||
19 | stdx = { path = "../stdx", version = "0.0.0" } | 18 | stdx = { path = "../stdx", version = "0.0.0" } |
20 | syntax = { path = "../syntax", version = "0.0.0" } | 19 | syntax = { path = "../syntax", version = "0.0.0" } |
21 | text_edit = { path = "../text_edit", version = "0.0.0" } | 20 | text_edit = { path = "../text_edit", version = "0.0.0" } |
@@ -23,6 +22,7 @@ base_db = { path = "../base_db", version = "0.0.0" } | |||
23 | ide_db = { path = "../ide_db", version = "0.0.0" } | 22 | ide_db = { path = "../ide_db", version = "0.0.0" } |
24 | profile = { path = "../profile", version = "0.0.0" } | 23 | profile = { path = "../profile", version = "0.0.0" } |
25 | test_utils = { path = "../test_utils", version = "0.0.0" } | 24 | test_utils = { path = "../test_utils", version = "0.0.0" } |
25 | ide_helpers = { path = "../ide_helpers", version = "0.0.0" } | ||
26 | 26 | ||
27 | # completions crate should depend only on the top-level `hir` package. if you need | 27 | # completions crate should depend only on the top-level `hir` package. if you need |
28 | # something from some `hir_xxx` subpackage, reexport the API via `hir`. | 28 | # something from some `hir_xxx` subpackage, reexport the API via `hir`. |
diff --git a/crates/completion/src/completions/record.rs b/crates/completion/src/completions/record.rs index 2049b9d09..218a1923c 100644 --- a/crates/completion/src/completions/record.rs +++ b/crates/completion/src/completions/record.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | //! Complete fields in record literals and patterns. | 1 | //! Complete fields in record literals and patterns. |
2 | use assists::utils::FamousDefs; | 2 | use ide_helpers::FamousDefs; |
3 | use syntax::ast::Expr; | 3 | use syntax::ast::Expr; |
4 | 4 | ||
5 | use crate::{ | 5 | use crate::{ |
@@ -45,8 +45,8 @@ pub(crate) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) -> | |||
45 | 45 | ||
46 | #[cfg(test)] | 46 | #[cfg(test)] |
47 | mod tests { | 47 | mod tests { |
48 | use assists::utils::FamousDefs; | ||
49 | use expect_test::{expect, Expect}; | 48 | use expect_test::{expect, Expect}; |
49 | use ide_helpers::FamousDefs; | ||
50 | 50 | ||
51 | use crate::{test_utils::completion_list, CompletionKind}; | 51 | use crate::{test_utils::completion_list, CompletionKind}; |
52 | 52 | ||
diff --git a/crates/completion/src/completions/unqualified_path.rs b/crates/completion/src/completions/unqualified_path.rs index 3bd776905..db5dbb7dd 100644 --- a/crates/completion/src/completions/unqualified_path.rs +++ b/crates/completion/src/completions/unqualified_path.rs | |||
@@ -1,9 +1,9 @@ | |||
1 | //! Completion of names from the current scope, e.g. locals and imported items. | 1 | //! Completion of names from the current scope, e.g. locals and imported items. |
2 | 2 | ||
3 | use assists::utils::ImportScope; | ||
4 | use either::Either; | 3 | use either::Either; |
5 | use hir::{Adt, ModuleDef, ScopeDef, Type}; | 4 | use hir::{Adt, ModuleDef, ScopeDef, Type}; |
6 | use ide_db::imports_locator; | 5 | use ide_db::imports_locator; |
6 | use ide_helpers::insert_use::ImportScope; | ||
7 | use syntax::AstNode; | 7 | use syntax::AstNode; |
8 | use test_utils::mark; | 8 | use test_utils::mark; |
9 | 9 | ||
diff --git a/crates/completion/src/config.rs b/crates/completion/src/config.rs index f50735372..1995b0754 100644 --- a/crates/completion/src/config.rs +++ b/crates/completion/src/config.rs | |||
@@ -4,7 +4,7 @@ | |||
4 | //! module, and we use to statically check that we only produce snippet | 4 | //! module, and we use to statically check that we only produce snippet |
5 | //! completions if we are allowed to. | 5 | //! completions if we are allowed to. |
6 | 6 | ||
7 | use assists::utils::MergeBehaviour; | 7 | use ide_helpers::insert_use::MergeBehaviour; |
8 | 8 | ||
9 | #[derive(Clone, Debug, PartialEq, Eq)] | 9 | #[derive(Clone, Debug, PartialEq, Eq)] |
10 | pub struct CompletionConfig { | 10 | pub struct CompletionConfig { |
diff --git a/crates/completion/src/item.rs b/crates/completion/src/item.rs index 7b62c2c4e..675cef8c4 100644 --- a/crates/completion/src/item.rs +++ b/crates/completion/src/item.rs | |||
@@ -2,8 +2,11 @@ | |||
2 | 2 | ||
3 | use std::fmt; | 3 | use std::fmt; |
4 | 4 | ||
5 | use assists::utils::{insert_use, mod_path_to_ast, ImportScope, MergeBehaviour}; | ||
6 | use hir::{Documentation, ModPath, Mutability}; | 5 | use hir::{Documentation, ModPath, Mutability}; |
6 | use ide_helpers::{ | ||
7 | insert_use::{self, ImportScope, MergeBehaviour}, | ||
8 | mod_path_to_ast, | ||
9 | }; | ||
7 | use syntax::{algo, TextRange}; | 10 | use syntax::{algo, TextRange}; |
8 | use text_edit::TextEdit; | 11 | use text_edit::TextEdit; |
9 | 12 | ||
@@ -300,7 +303,7 @@ impl Builder { | |||
300 | label = format!("{}::{}", import_path_without_last_segment, label); | 303 | label = format!("{}::{}", import_path_without_last_segment, label); |
301 | } | 304 | } |
302 | 305 | ||
303 | let rewriter = insert_use(&import_scope, import, merge_behaviour); | 306 | let rewriter = insert_use::insert_use(&import_scope, import, merge_behaviour); |
304 | if let Some(old_ast) = rewriter.rewrite_root() { | 307 | if let Some(old_ast) = rewriter.rewrite_root() { |
305 | algo::diff(&old_ast, &rewriter.rewrite(&old_ast)).into_text_edit(&mut text_edits); | 308 | algo::diff(&old_ast, &rewriter.rewrite(&old_ast)).into_text_edit(&mut text_edits); |
306 | } | 309 | } |
diff --git a/crates/completion/src/render.rs b/crates/completion/src/render.rs index bce02f577..e9704c27c 100644 --- a/crates/completion/src/render.rs +++ b/crates/completion/src/render.rs | |||
@@ -9,9 +9,9 @@ pub(crate) mod type_alias; | |||
9 | 9 | ||
10 | mod builder_ext; | 10 | mod builder_ext; |
11 | 11 | ||
12 | use assists::utils::{ImportScope, MergeBehaviour}; | ||
13 | use hir::{Documentation, HasAttrs, HirDisplay, ModPath, Mutability, ScopeDef, Type}; | 12 | use hir::{Documentation, HasAttrs, HirDisplay, ModPath, Mutability, ScopeDef, Type}; |
14 | use ide_db::RootDatabase; | 13 | use ide_db::RootDatabase; |
14 | use ide_helpers::insert_use::{ImportScope, MergeBehaviour}; | ||
15 | use syntax::TextRange; | 15 | use syntax::TextRange; |
16 | use test_utils::mark; | 16 | use test_utils::mark; |
17 | 17 | ||
diff --git a/crates/completion/src/render/enum_variant.rs b/crates/completion/src/render/enum_variant.rs index 64e742b77..5d4fbb641 100644 --- a/crates/completion/src/render/enum_variant.rs +++ b/crates/completion/src/render/enum_variant.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! Renderer for `enum` variants. | 1 | //! Renderer for `enum` variants. |
2 | 2 | ||
3 | use assists::utils::{ImportScope, MergeBehaviour}; | ||
4 | use hir::{HasAttrs, HirDisplay, ModPath, StructKind}; | 3 | use hir::{HasAttrs, HirDisplay, ModPath, StructKind}; |
4 | use ide_helpers::insert_use::{ImportScope, MergeBehaviour}; | ||
5 | use itertools::Itertools; | 5 | use itertools::Itertools; |
6 | use test_utils::mark; | 6 | use test_utils::mark; |
7 | 7 | ||
diff --git a/crates/completion/src/render/function.rs b/crates/completion/src/render/function.rs index e8b726ad6..07e99058a 100644 --- a/crates/completion/src/render/function.rs +++ b/crates/completion/src/render/function.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! Renderer for function calls. | 1 | //! Renderer for function calls. |
2 | 2 | ||
3 | use assists::utils::{ImportScope, MergeBehaviour}; | ||
4 | use hir::{HasSource, ModPath, Type}; | 3 | use hir::{HasSource, ModPath, Type}; |
4 | use ide_helpers::insert_use::{ImportScope, MergeBehaviour}; | ||
5 | use syntax::{ast::Fn, display::function_declaration}; | 5 | use syntax::{ast::Fn, display::function_declaration}; |
6 | 6 | ||
7 | use crate::{ | 7 | use crate::{ |
diff --git a/crates/completion/src/render/macro_.rs b/crates/completion/src/render/macro_.rs index 91055a296..b1284f201 100644 --- a/crates/completion/src/render/macro_.rs +++ b/crates/completion/src/render/macro_.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! Renderer for macro invocations. | 1 | //! Renderer for macro invocations. |
2 | 2 | ||
3 | use assists::utils::{ImportScope, MergeBehaviour}; | ||
4 | use hir::{Documentation, HasSource, ModPath}; | 3 | use hir::{Documentation, HasSource, ModPath}; |
4 | use ide_helpers::insert_use::{ImportScope, MergeBehaviour}; | ||
5 | use syntax::display::macro_label; | 5 | use syntax::display::macro_label; |
6 | use test_utils::mark; | 6 | use test_utils::mark; |
7 | 7 | ||
@@ -12,6 +12,7 @@ use crate::{ | |||
12 | 12 | ||
13 | pub(crate) fn render_macro<'a>( | 13 | pub(crate) fn render_macro<'a>( |
14 | ctx: RenderContext<'a>, | 14 | ctx: RenderContext<'a>, |
15 | // TODO kb add some object instead of a tuple? | ||
15 | import_data: Option<(ModPath, ImportScope, Option<MergeBehaviour>)>, | 16 | import_data: Option<(ModPath, ImportScope, Option<MergeBehaviour>)>, |
16 | name: String, | 17 | name: String, |
17 | macro_: hir::MacroDef, | 18 | macro_: hir::MacroDef, |