diff --git a/Cargo.lock b/Cargo.lock index ae25ad764f..f672225c66 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -245,25 +245,6 @@ dependencies = [ "cc", ] -[[package]] -name = "completion" -version = "0.0.0" -dependencies = [ - "base_db", - "either", - "expect-test", - "hir", - "ide_db", - "itertools 0.10.0", - "log", - "profile", - "rustc-hash", - "stdx", - "syntax", - "test_utils", - "text_edit", -] - [[package]] name = "const_fn" version = "0.4.5" @@ -613,10 +594,10 @@ version = "0.0.0" dependencies = [ "assists", "cfg", - "completion", "either", "expect-test", "hir", + "ide_completion", "ide_db", "indexmap", "itertools 0.10.0", @@ -634,6 +615,25 @@ dependencies = [ "url", ] +[[package]] +name = "ide_completion" +version = "0.0.0" +dependencies = [ + "base_db", + "either", + "expect-test", + "hir", + "ide_db", + "itertools 0.10.0", + "log", + "profile", + "rustc-hash", + "stdx", + "syntax", + "test_utils", + "text_edit", +] + [[package]] name = "ide_db" version = "0.0.0" diff --git a/crates/ide/Cargo.toml b/crates/ide/Cargo.toml index bb28cca4d4..3cbe3a3974 100644 --- a/crates/ide/Cargo.toml +++ b/crates/ide/Cargo.toml @@ -29,7 +29,7 @@ profile = { path = "../profile", version = "0.0.0" } test_utils = { path = "../test_utils", version = "0.0.0" } assists = { path = "../assists", version = "0.0.0" } ssr = { path = "../ssr", version = "0.0.0" } -completion = { path = "../completion", version = "0.0.0" } +ide_completion = { path = "../ide_completion", version = "0.0.0" } # ide should depend only on the top-level `hir` package. if you need # something from some `hir_xxx` subpackage, reexport the API via `hir`. diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index a2c8db505d..f47ec61fe4 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -83,11 +83,11 @@ pub use crate::{ }, }; pub use assists::{Assist, AssistConfig, AssistId, AssistKind}; -pub use completion::{ +pub use hir::{Documentation, Semantics}; +pub use ide_completion::{ CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, ImportEdit, InsertTextFormat, }; -pub use hir::{Documentation, Semantics}; pub use ide_db::{ base_db::{ Canceled, Change, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, @@ -468,7 +468,7 @@ impl Analysis { config: &CompletionConfig, position: FilePosition, ) -> Cancelable>> { - self.with_db(|db| completion::completions(db, config, position).map(Into::into)) + self.with_db(|db| ide_completion::completions(db, config, position).map(Into::into)) } /// Resolves additional completion data at the position given. @@ -482,7 +482,7 @@ impl Analysis { ) -> Cancelable> { Ok(self .with_db(|db| { - completion::resolve_completion_edits( + ide_completion::resolve_completion_edits( db, config, position, diff --git a/crates/completion/Cargo.toml b/crates/ide_completion/Cargo.toml similarity index 97% rename from crates/completion/Cargo.toml rename to crates/ide_completion/Cargo.toml index 99a1bdd544..c09101ccbf 100644 --- a/crates/completion/Cargo.toml +++ b/crates/ide_completion/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "completion" +name = "ide_completion" version = "0.0.0" description = "TBD" license = "MIT OR Apache-2.0" diff --git a/crates/completion/src/completions.rs b/crates/ide_completion/src/completions.rs similarity index 100% rename from crates/completion/src/completions.rs rename to crates/ide_completion/src/completions.rs diff --git a/crates/completion/src/completions/attribute.rs b/crates/ide_completion/src/completions/attribute.rs similarity index 100% rename from crates/completion/src/completions/attribute.rs rename to crates/ide_completion/src/completions/attribute.rs diff --git a/crates/completion/src/completions/dot.rs b/crates/ide_completion/src/completions/dot.rs similarity index 100% rename from crates/completion/src/completions/dot.rs rename to crates/ide_completion/src/completions/dot.rs diff --git a/crates/completion/src/completions/flyimport.rs b/crates/ide_completion/src/completions/flyimport.rs similarity index 100% rename from crates/completion/src/completions/flyimport.rs rename to crates/ide_completion/src/completions/flyimport.rs diff --git a/crates/completion/src/completions/fn_param.rs b/crates/ide_completion/src/completions/fn_param.rs similarity index 100% rename from crates/completion/src/completions/fn_param.rs rename to crates/ide_completion/src/completions/fn_param.rs diff --git a/crates/completion/src/completions/keyword.rs b/crates/ide_completion/src/completions/keyword.rs similarity index 100% rename from crates/completion/src/completions/keyword.rs rename to crates/ide_completion/src/completions/keyword.rs diff --git a/crates/completion/src/completions/macro_in_item_position.rs b/crates/ide_completion/src/completions/macro_in_item_position.rs similarity index 100% rename from crates/completion/src/completions/macro_in_item_position.rs rename to crates/ide_completion/src/completions/macro_in_item_position.rs diff --git a/crates/completion/src/completions/mod_.rs b/crates/ide_completion/src/completions/mod_.rs similarity index 100% rename from crates/completion/src/completions/mod_.rs rename to crates/ide_completion/src/completions/mod_.rs diff --git a/crates/completion/src/completions/pattern.rs b/crates/ide_completion/src/completions/pattern.rs similarity index 100% rename from crates/completion/src/completions/pattern.rs rename to crates/ide_completion/src/completions/pattern.rs diff --git a/crates/completion/src/completions/postfix.rs b/crates/ide_completion/src/completions/postfix.rs similarity index 100% rename from crates/completion/src/completions/postfix.rs rename to crates/ide_completion/src/completions/postfix.rs diff --git a/crates/completion/src/completions/postfix/format_like.rs b/crates/ide_completion/src/completions/postfix/format_like.rs similarity index 100% rename from crates/completion/src/completions/postfix/format_like.rs rename to crates/ide_completion/src/completions/postfix/format_like.rs diff --git a/crates/completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs similarity index 100% rename from crates/completion/src/completions/qualified_path.rs rename to crates/ide_completion/src/completions/qualified_path.rs diff --git a/crates/completion/src/completions/record.rs b/crates/ide_completion/src/completions/record.rs similarity index 100% rename from crates/completion/src/completions/record.rs rename to crates/ide_completion/src/completions/record.rs diff --git a/crates/completion/src/completions/snippet.rs b/crates/ide_completion/src/completions/snippet.rs similarity index 100% rename from crates/completion/src/completions/snippet.rs rename to crates/ide_completion/src/completions/snippet.rs diff --git a/crates/completion/src/completions/trait_impl.rs b/crates/ide_completion/src/completions/trait_impl.rs similarity index 100% rename from crates/completion/src/completions/trait_impl.rs rename to crates/ide_completion/src/completions/trait_impl.rs diff --git a/crates/completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs similarity index 100% rename from crates/completion/src/completions/unqualified_path.rs rename to crates/ide_completion/src/completions/unqualified_path.rs diff --git a/crates/completion/src/config.rs b/crates/ide_completion/src/config.rs similarity index 100% rename from crates/completion/src/config.rs rename to crates/ide_completion/src/config.rs diff --git a/crates/completion/src/context.rs b/crates/ide_completion/src/context.rs similarity index 100% rename from crates/completion/src/context.rs rename to crates/ide_completion/src/context.rs diff --git a/crates/completion/src/generated_lint_completions.rs b/crates/ide_completion/src/generated_lint_completions.rs similarity index 100% rename from crates/completion/src/generated_lint_completions.rs rename to crates/ide_completion/src/generated_lint_completions.rs diff --git a/crates/completion/src/item.rs b/crates/ide_completion/src/item.rs similarity index 100% rename from crates/completion/src/item.rs rename to crates/ide_completion/src/item.rs diff --git a/crates/completion/src/lib.rs b/crates/ide_completion/src/lib.rs similarity index 100% rename from crates/completion/src/lib.rs rename to crates/ide_completion/src/lib.rs diff --git a/crates/completion/src/patterns.rs b/crates/ide_completion/src/patterns.rs similarity index 100% rename from crates/completion/src/patterns.rs rename to crates/ide_completion/src/patterns.rs diff --git a/crates/completion/src/render.rs b/crates/ide_completion/src/render.rs similarity index 100% rename from crates/completion/src/render.rs rename to crates/ide_completion/src/render.rs diff --git a/crates/completion/src/render/builder_ext.rs b/crates/ide_completion/src/render/builder_ext.rs similarity index 100% rename from crates/completion/src/render/builder_ext.rs rename to crates/ide_completion/src/render/builder_ext.rs diff --git a/crates/completion/src/render/const_.rs b/crates/ide_completion/src/render/const_.rs similarity index 100% rename from crates/completion/src/render/const_.rs rename to crates/ide_completion/src/render/const_.rs diff --git a/crates/completion/src/render/enum_variant.rs b/crates/ide_completion/src/render/enum_variant.rs similarity index 100% rename from crates/completion/src/render/enum_variant.rs rename to crates/ide_completion/src/render/enum_variant.rs diff --git a/crates/completion/src/render/function.rs b/crates/ide_completion/src/render/function.rs similarity index 100% rename from crates/completion/src/render/function.rs rename to crates/ide_completion/src/render/function.rs diff --git a/crates/completion/src/render/macro_.rs b/crates/ide_completion/src/render/macro_.rs similarity index 100% rename from crates/completion/src/render/macro_.rs rename to crates/ide_completion/src/render/macro_.rs diff --git a/crates/completion/src/render/pattern.rs b/crates/ide_completion/src/render/pattern.rs similarity index 100% rename from crates/completion/src/render/pattern.rs rename to crates/ide_completion/src/render/pattern.rs diff --git a/crates/completion/src/render/type_alias.rs b/crates/ide_completion/src/render/type_alias.rs similarity index 100% rename from crates/completion/src/render/type_alias.rs rename to crates/ide_completion/src/render/type_alias.rs diff --git a/crates/completion/src/test_utils.rs b/crates/ide_completion/src/test_utils.rs similarity index 100% rename from crates/completion/src/test_utils.rs rename to crates/ide_completion/src/test_utils.rs diff --git a/xtask/src/codegen/gen_lint_completions.rs b/xtask/src/codegen/gen_lint_completions.rs index b974212171..25f770eaf0 100644 --- a/xtask/src/codegen/gen_lint_completions.rs +++ b/xtask/src/codegen/gen_lint_completions.rs @@ -26,7 +26,8 @@ pub fn generate_lint_completions(mode: Mode) -> Result<()> { }; let contents = reformat(ts.to_string().as_str())?; - let destination = project_root().join("crates/completion/src/generated_lint_completions.rs"); + let destination = + project_root().join("crates/ide_completion/src/generated_lint_completions.rs"); update(destination.as_path(), &contents, mode)?; run_rustfmt(mode)?; diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index cb83e07fd1..909c52afad 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs @@ -172,7 +172,7 @@ https://github.blog/2015-06-08-how-to-undo-almost-anything-with-git/#redo-after- fn deny_clippy(path: &PathBuf, text: &String) { let ignore = &[ // The documentation in string literals may contain anything for its own purposes - "completion/src/generated_lint_completions.rs", + "ide_completion/src/generated_lint_completions.rs", ]; if ignore.iter().any(|p| path.ends_with(p)) { return; @@ -259,7 +259,7 @@ fn check_todo(path: &Path, text: &str) { // `ast::make`. "ast/make.rs", // The documentation in string literals may contain anything for its own purposes - "completion/src/generated_lint_completions.rs", + "ide_completion/src/generated_lint_completions.rs", ]; if need_todo.iter().any(|p| path.ends_with(p)) { return; @@ -286,10 +286,10 @@ fn check_dbg(path: &Path, text: &str) { // Assists to remove `dbg!()` "handlers/remove_dbg.rs", // We have .dbg postfix - "completion/src/completions/postfix.rs", + "ide_completion/src/completions/postfix.rs", // The documentation in string literals may contain anything for its own purposes - "completion/src/lib.rs", - "completion/src/generated_lint_completions.rs", + "ide_completion/src/lib.rs", + "ide_completion/src/generated_lint_completions.rs", // test for doc test for remove_dbg "src/tests/generated.rs", ];