From 3db64a400c78bbd2708e67ddc07df1001fff3f29 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 17 Feb 2021 17:53:31 +0300 Subject: [PATCH] rename completion -> ide_completion We don't have completion-related PRs in flight, so lets do it --- Cargo.lock | 40 +++++++++---------- crates/ide/Cargo.toml | 2 +- crates/ide/src/lib.rs | 8 ++-- .../{completion => ide_completion}/Cargo.toml | 2 +- .../src/completions.rs | 0 .../src/completions/attribute.rs | 0 .../src/completions/dot.rs | 0 .../src/completions/flyimport.rs | 0 .../src/completions/fn_param.rs | 0 .../src/completions/keyword.rs | 0 .../src/completions/macro_in_item_position.rs | 0 .../src/completions/mod_.rs | 0 .../src/completions/pattern.rs | 0 .../src/completions/postfix.rs | 0 .../src/completions/postfix/format_like.rs | 0 .../src/completions/qualified_path.rs | 0 .../src/completions/record.rs | 0 .../src/completions/snippet.rs | 0 .../src/completions/trait_impl.rs | 0 .../src/completions/unqualified_path.rs | 0 .../src/config.rs | 0 .../src/context.rs | 0 .../src/generated_lint_completions.rs | 0 .../src/item.rs | 0 .../{completion => ide_completion}/src/lib.rs | 0 .../src/patterns.rs | 0 .../src/render.rs | 0 .../src/render/builder_ext.rs | 0 .../src/render/const_.rs | 0 .../src/render/enum_variant.rs | 0 .../src/render/function.rs | 0 .../src/render/macro_.rs | 0 .../src/render/pattern.rs | 0 .../src/render/type_alias.rs | 0 .../src/test_utils.rs | 0 xtask/src/codegen/gen_lint_completions.rs | 3 +- xtask/tests/tidy.rs | 10 ++--- 37 files changed, 33 insertions(+), 32 deletions(-) rename crates/{completion => ide_completion}/Cargo.toml (97%) rename crates/{completion => ide_completion}/src/completions.rs (100%) rename crates/{completion => ide_completion}/src/completions/attribute.rs (100%) rename crates/{completion => ide_completion}/src/completions/dot.rs (100%) rename crates/{completion => ide_completion}/src/completions/flyimport.rs (100%) rename crates/{completion => ide_completion}/src/completions/fn_param.rs (100%) rename crates/{completion => ide_completion}/src/completions/keyword.rs (100%) rename crates/{completion => ide_completion}/src/completions/macro_in_item_position.rs (100%) rename crates/{completion => ide_completion}/src/completions/mod_.rs (100%) rename crates/{completion => ide_completion}/src/completions/pattern.rs (100%) rename crates/{completion => ide_completion}/src/completions/postfix.rs (100%) rename crates/{completion => ide_completion}/src/completions/postfix/format_like.rs (100%) rename crates/{completion => ide_completion}/src/completions/qualified_path.rs (100%) rename crates/{completion => ide_completion}/src/completions/record.rs (100%) rename crates/{completion => ide_completion}/src/completions/snippet.rs (100%) rename crates/{completion => ide_completion}/src/completions/trait_impl.rs (100%) rename crates/{completion => ide_completion}/src/completions/unqualified_path.rs (100%) rename crates/{completion => ide_completion}/src/config.rs (100%) rename crates/{completion => ide_completion}/src/context.rs (100%) rename crates/{completion => ide_completion}/src/generated_lint_completions.rs (100%) rename crates/{completion => ide_completion}/src/item.rs (100%) rename crates/{completion => ide_completion}/src/lib.rs (100%) rename crates/{completion => ide_completion}/src/patterns.rs (100%) rename crates/{completion => ide_completion}/src/render.rs (100%) rename crates/{completion => ide_completion}/src/render/builder_ext.rs (100%) rename crates/{completion => ide_completion}/src/render/const_.rs (100%) rename crates/{completion => ide_completion}/src/render/enum_variant.rs (100%) rename crates/{completion => ide_completion}/src/render/function.rs (100%) rename crates/{completion => ide_completion}/src/render/macro_.rs (100%) rename crates/{completion => ide_completion}/src/render/pattern.rs (100%) rename crates/{completion => ide_completion}/src/render/type_alias.rs (100%) rename crates/{completion => ide_completion}/src/test_utils.rs (100%) 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", ];