diff --git a/Cargo.lock b/Cargo.lock index a69aef199f..bc0f0862d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -127,20 +127,6 @@ version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" -[[package]] -name = "call_info" -version = "0.0.0" -dependencies = [ - "base_db", - "either", - "expect-test", - "hir", - "ide_db", - "stdx", - "syntax", - "test_utils", -] - [[package]] name = "cargo_metadata" version = "0.12.0" @@ -269,7 +255,6 @@ name = "completion" version = "0.0.0" dependencies = [ "base_db", - "call_info", "expect-test", "hir", "ide_db", @@ -643,7 +628,6 @@ version = "0.0.0" dependencies = [ "assists", "base_db", - "call_info", "cfg", "completion", "either", @@ -672,6 +656,7 @@ version = "0.0.0" dependencies = [ "base_db", "either", + "expect-test", "fst", "hir", "log", diff --git a/crates/call_info/Cargo.toml b/crates/call_info/Cargo.toml deleted file mode 100644 index 98c0bd6dbe..0000000000 --- a/crates/call_info/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -name = "call_info" -version = "0.0.0" -description = "TBD" -license = "MIT OR Apache-2.0" -authors = ["rust-analyzer developers"] -edition = "2018" - -[lib] -doctest = false - -[dependencies] -either = "1.5.3" - -stdx = { path = "../stdx", version = "0.0.0" } -syntax = { path = "../syntax", version = "0.0.0" } -base_db = { path = "../base_db", version = "0.0.0" } -ide_db = { path = "../ide_db", version = "0.0.0" } -test_utils = { path = "../test_utils", version = "0.0.0" } - -# call_info crate should depend only on the top-level `hir` package. if you need -# something from some `hir_xxx` subpackage, reexport the API via `hir`. -hir = { path = "../hir", version = "0.0.0" } - -[dev-dependencies] -expect-test = "1.0" diff --git a/crates/completion/Cargo.toml b/crates/completion/Cargo.toml index 8b6e80448f..b79ee33f73 100644 --- a/crates/completion/Cargo.toml +++ b/crates/completion/Cargo.toml @@ -21,7 +21,6 @@ base_db = { path = "../base_db", version = "0.0.0" } ide_db = { path = "../ide_db", version = "0.0.0" } profile = { path = "../profile", version = "0.0.0" } test_utils = { path = "../test_utils", version = "0.0.0" } -call_info = { path = "../call_info", version = "0.0.0" } # completions crate 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/completion/src/completion_context.rs b/crates/completion/src/completion_context.rs index e4f86d0e01..97c5c04ba5 100644 --- a/crates/completion/src/completion_context.rs +++ b/crates/completion/src/completion_context.rs @@ -1,9 +1,8 @@ //! See `CompletionContext` structure. use base_db::{FilePosition, SourceDatabase}; -use call_info::ActiveParameter; use hir::{Local, ScopeDef, Semantics, SemanticsScope, Type}; -use ide_db::RootDatabase; +use ide_db::{call_info::ActiveParameter, RootDatabase}; use syntax::{ algo::{find_covering_element, find_node_at_offset}, ast, match_ast, AstNode, NodeOrToken, diff --git a/crates/ide/Cargo.toml b/crates/ide/Cargo.toml index 76b52fa047..145c6156cc 100644 --- a/crates/ide/Cargo.toml +++ b/crates/ide/Cargo.toml @@ -30,7 +30,6 @@ 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" } -call_info = { path = "../call_info", version = "0.0.0" } completion = { path = "../completion", version = "0.0.0" } # ide should depend only on the top-level `hir` package. if you need diff --git a/crates/ide/src/call_hierarchy.rs b/crates/ide/src/call_hierarchy.rs index 9d6433fe07..a259d98496 100644 --- a/crates/ide/src/call_hierarchy.rs +++ b/crates/ide/src/call_hierarchy.rs @@ -2,8 +2,8 @@ use indexmap::IndexMap; -use call_info::FnCallNode; use hir::Semantics; +use ide_db::call_info::FnCallNode; use ide_db::RootDatabase; use syntax::{ast, match_ast, AstNode, TextRange}; diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index cecfae4c70..d84b970d46 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -80,10 +80,10 @@ pub use crate::{ Highlight, HighlightModifier, HighlightModifiers, HighlightTag, HighlightedRange, }, }; -pub use call_info::CallInfo; pub use completion::{ CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat, }; +pub use ide_db::call_info::CallInfo; pub use assists::{ utils::MergeBehaviour, Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist, @@ -396,7 +396,7 @@ impl Analysis { /// Computes parameter information for the given call expression. pub fn call_info(&self, position: FilePosition) -> Cancelable> { - self.with_db(|db| call_info::call_info(db, position)) + self.with_db(|db| ide_db::call_info::call_info(db, position)) } /// Computes call hierarchy candidates for the given file position. diff --git a/crates/ide/src/syntax_highlighting/injection.rs b/crates/ide/src/syntax_highlighting/injection.rs index acd91b26c0..59a74bc02e 100644 --- a/crates/ide/src/syntax_highlighting/injection.rs +++ b/crates/ide/src/syntax_highlighting/injection.rs @@ -3,8 +3,8 @@ use std::{collections::BTreeMap, convert::TryFrom}; use ast::{HasQuotes, HasStringValue}; -use call_info::ActiveParameter; use hir::Semantics; +use ide_db::call_info::ActiveParameter; use itertools::Itertools; use syntax::{ast, AstToken, SyntaxNode, SyntaxToken, TextRange, TextSize}; diff --git a/crates/ide_db/Cargo.toml b/crates/ide_db/Cargo.toml index 320fb15e55..3ff7a1a6a0 100644 --- a/crates/ide_db/Cargo.toml +++ b/crates/ide_db/Cargo.toml @@ -29,3 +29,6 @@ test_utils = { path = "../test_utils", 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`. hir = { path = "../hir", version = "0.0.0" } + +[dev-dependencies] +expect-test = "1.0" diff --git a/crates/call_info/src/lib.rs b/crates/ide_db/src/call_info.rs similarity index 99% rename from crates/call_info/src/lib.rs rename to crates/ide_db/src/call_info.rs index c45406c253..83a602b9ad 100644 --- a/crates/call_info/src/lib.rs +++ b/crates/ide_db/src/call_info.rs @@ -2,7 +2,6 @@ use base_db::FilePosition; use either::Either; use hir::{HasAttrs, HirDisplay, Semantics, Type}; -use ide_db::RootDatabase; use stdx::format_to; use syntax::{ ast::{self, ArgListOwner}, @@ -10,6 +9,8 @@ use syntax::{ }; use test_utils::mark; +use crate::RootDatabase; + /// Contains information about a call site. Specifically the /// `FunctionSignature`and current parameter. #[derive(Debug)] @@ -228,9 +229,9 @@ impl FnCallNode { #[cfg(test)] mod tests { + use crate::RootDatabase; use base_db::{fixture::ChangeFixture, FilePosition}; use expect_test::{expect, Expect}; - use ide_db::RootDatabase; use test_utils::{mark, RangeOrOffset}; /// Creates analysis from a multi-file fixture, returns positions marked with <|>. @@ -249,7 +250,7 @@ mod tests { fn check(ra_fixture: &str, expect: Expect) { let (db, position) = position(ra_fixture); - let call_info = crate::call_info(&db, position); + let call_info = crate::call_info::call_info(&db, position); let actual = match call_info { Some(call_info) => { let docs = match &call_info.doc { diff --git a/crates/ide_db/src/lib.rs b/crates/ide_db/src/lib.rs index 88f74265cf..303f7c964b 100644 --- a/crates/ide_db/src/lib.rs +++ b/crates/ide_db/src/lib.rs @@ -12,6 +12,7 @@ pub mod imports_locator; pub mod source_change; pub mod ty_filter; pub mod traits; +pub mod call_info; use std::{fmt, sync::Arc};