diff options
-rw-r--r-- | Cargo.lock | 17 | ||||
-rw-r--r-- | crates/call_info/Cargo.toml | 26 | ||||
-rw-r--r-- | crates/completion/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/completion/src/completion_context.rs | 3 | ||||
-rw-r--r-- | crates/ide/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/ide/src/call_hierarchy.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/lib.rs | 4 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting/injection.rs | 2 | ||||
-rw-r--r-- | crates/ide_db/Cargo.toml | 3 | ||||
-rw-r--r-- | crates/ide_db/src/call_info.rs (renamed from crates/call_info/src/lib.rs) | 7 | ||||
-rw-r--r-- | crates/ide_db/src/lib.rs | 1 |
11 files changed, 14 insertions, 53 deletions
diff --git a/Cargo.lock b/Cargo.lock index a69aef199..bc0f0862d 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -128,20 +128,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
128 | checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" | 128 | checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" |
129 | 129 | ||
130 | [[package]] | 130 | [[package]] |
131 | name = "call_info" | ||
132 | version = "0.0.0" | ||
133 | dependencies = [ | ||
134 | "base_db", | ||
135 | "either", | ||
136 | "expect-test", | ||
137 | "hir", | ||
138 | "ide_db", | ||
139 | "stdx", | ||
140 | "syntax", | ||
141 | "test_utils", | ||
142 | ] | ||
143 | |||
144 | [[package]] | ||
145 | name = "cargo_metadata" | 131 | name = "cargo_metadata" |
146 | version = "0.12.0" | 132 | version = "0.12.0" |
147 | source = "registry+https://github.com/rust-lang/crates.io-index" | 133 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -269,7 +255,6 @@ name = "completion" | |||
269 | version = "0.0.0" | 255 | version = "0.0.0" |
270 | dependencies = [ | 256 | dependencies = [ |
271 | "base_db", | 257 | "base_db", |
272 | "call_info", | ||
273 | "expect-test", | 258 | "expect-test", |
274 | "hir", | 259 | "hir", |
275 | "ide_db", | 260 | "ide_db", |
@@ -643,7 +628,6 @@ version = "0.0.0" | |||
643 | dependencies = [ | 628 | dependencies = [ |
644 | "assists", | 629 | "assists", |
645 | "base_db", | 630 | "base_db", |
646 | "call_info", | ||
647 | "cfg", | 631 | "cfg", |
648 | "completion", | 632 | "completion", |
649 | "either", | 633 | "either", |
@@ -672,6 +656,7 @@ version = "0.0.0" | |||
672 | dependencies = [ | 656 | dependencies = [ |
673 | "base_db", | 657 | "base_db", |
674 | "either", | 658 | "either", |
659 | "expect-test", | ||
675 | "fst", | 660 | "fst", |
676 | "hir", | 661 | "hir", |
677 | "log", | 662 | "log", |
diff --git a/crates/call_info/Cargo.toml b/crates/call_info/Cargo.toml deleted file mode 100644 index 98c0bd6db..000000000 --- a/crates/call_info/Cargo.toml +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | [package] | ||
2 | name = "call_info" | ||
3 | version = "0.0.0" | ||
4 | description = "TBD" | ||
5 | license = "MIT OR Apache-2.0" | ||
6 | authors = ["rust-analyzer developers"] | ||
7 | edition = "2018" | ||
8 | |||
9 | [lib] | ||
10 | doctest = false | ||
11 | |||
12 | [dependencies] | ||
13 | either = "1.5.3" | ||
14 | |||
15 | stdx = { path = "../stdx", version = "0.0.0" } | ||
16 | syntax = { path = "../syntax", version = "0.0.0" } | ||
17 | base_db = { path = "../base_db", version = "0.0.0" } | ||
18 | ide_db = { path = "../ide_db", version = "0.0.0" } | ||
19 | test_utils = { path = "../test_utils", version = "0.0.0" } | ||
20 | |||
21 | # call_info crate should depend only on the top-level `hir` package. if you need | ||
22 | # something from some `hir_xxx` subpackage, reexport the API via `hir`. | ||
23 | hir = { path = "../hir", version = "0.0.0" } | ||
24 | |||
25 | [dev-dependencies] | ||
26 | expect-test = "1.0" | ||
diff --git a/crates/completion/Cargo.toml b/crates/completion/Cargo.toml index 8b6e80448..b79ee33f7 100644 --- a/crates/completion/Cargo.toml +++ b/crates/completion/Cargo.toml | |||
@@ -21,7 +21,6 @@ base_db = { path = "../base_db", version = "0.0.0" } | |||
21 | ide_db = { path = "../ide_db", version = "0.0.0" } | 21 | ide_db = { path = "../ide_db", version = "0.0.0" } |
22 | profile = { path = "../profile", version = "0.0.0" } | 22 | profile = { path = "../profile", version = "0.0.0" } |
23 | test_utils = { path = "../test_utils", version = "0.0.0" } | 23 | test_utils = { path = "../test_utils", version = "0.0.0" } |
24 | call_info = { path = "../call_info", version = "0.0.0" } | ||
25 | 24 | ||
26 | # completions crate should depend only on the top-level `hir` package. if you need | 25 | # completions crate should depend only on the top-level `hir` package. if you need |
27 | # something from some `hir_xxx` subpackage, reexport the API via `hir`. | 26 | # 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 e4f86d0e0..97c5c04ba 100644 --- a/crates/completion/src/completion_context.rs +++ b/crates/completion/src/completion_context.rs | |||
@@ -1,9 +1,8 @@ | |||
1 | //! See `CompletionContext` structure. | 1 | //! See `CompletionContext` structure. |
2 | 2 | ||
3 | use base_db::{FilePosition, SourceDatabase}; | 3 | use base_db::{FilePosition, SourceDatabase}; |
4 | use call_info::ActiveParameter; | ||
5 | use hir::{Local, ScopeDef, Semantics, SemanticsScope, Type}; | 4 | use hir::{Local, ScopeDef, Semantics, SemanticsScope, Type}; |
6 | use ide_db::RootDatabase; | 5 | use ide_db::{call_info::ActiveParameter, RootDatabase}; |
7 | use syntax::{ | 6 | use syntax::{ |
8 | algo::{find_covering_element, find_node_at_offset}, | 7 | algo::{find_covering_element, find_node_at_offset}, |
9 | ast, match_ast, AstNode, NodeOrToken, | 8 | ast, match_ast, AstNode, NodeOrToken, |
diff --git a/crates/ide/Cargo.toml b/crates/ide/Cargo.toml index 76b52fa04..145c6156c 100644 --- a/crates/ide/Cargo.toml +++ b/crates/ide/Cargo.toml | |||
@@ -30,7 +30,6 @@ profile = { path = "../profile", version = "0.0.0" } | |||
30 | test_utils = { path = "../test_utils", version = "0.0.0" } | 30 | test_utils = { path = "../test_utils", version = "0.0.0" } |
31 | assists = { path = "../assists", version = "0.0.0" } | 31 | assists = { path = "../assists", version = "0.0.0" } |
32 | ssr = { path = "../ssr", version = "0.0.0" } | 32 | ssr = { path = "../ssr", version = "0.0.0" } |
33 | call_info = { path = "../call_info", version = "0.0.0" } | ||
34 | completion = { path = "../completion", version = "0.0.0" } | 33 | completion = { path = "../completion", version = "0.0.0" } |
35 | 34 | ||
36 | # ide should depend only on the top-level `hir` package. if you need | 35 | # 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 9d6433fe0..a259d9849 100644 --- a/crates/ide/src/call_hierarchy.rs +++ b/crates/ide/src/call_hierarchy.rs | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | use indexmap::IndexMap; | 3 | use indexmap::IndexMap; |
4 | 4 | ||
5 | use call_info::FnCallNode; | ||
6 | use hir::Semantics; | 5 | use hir::Semantics; |
6 | use ide_db::call_info::FnCallNode; | ||
7 | use ide_db::RootDatabase; | 7 | use ide_db::RootDatabase; |
8 | use syntax::{ast, match_ast, AstNode, TextRange}; | 8 | use syntax::{ast, match_ast, AstNode, TextRange}; |
9 | 9 | ||
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index cecfae4c7..d84b970d4 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs | |||
@@ -80,10 +80,10 @@ pub use crate::{ | |||
80 | Highlight, HighlightModifier, HighlightModifiers, HighlightTag, HighlightedRange, | 80 | Highlight, HighlightModifier, HighlightModifiers, HighlightTag, HighlightedRange, |
81 | }, | 81 | }, |
82 | }; | 82 | }; |
83 | pub use call_info::CallInfo; | ||
84 | pub use completion::{ | 83 | pub use completion::{ |
85 | CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat, | 84 | CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat, |
86 | }; | 85 | }; |
86 | pub use ide_db::call_info::CallInfo; | ||
87 | 87 | ||
88 | pub use assists::{ | 88 | pub use assists::{ |
89 | utils::MergeBehaviour, Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist, | 89 | utils::MergeBehaviour, Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist, |
@@ -396,7 +396,7 @@ impl Analysis { | |||
396 | 396 | ||
397 | /// Computes parameter information for the given call expression. | 397 | /// Computes parameter information for the given call expression. |
398 | pub fn call_info(&self, position: FilePosition) -> Cancelable<Option<CallInfo>> { | 398 | pub fn call_info(&self, position: FilePosition) -> Cancelable<Option<CallInfo>> { |
399 | self.with_db(|db| call_info::call_info(db, position)) | 399 | self.with_db(|db| ide_db::call_info::call_info(db, position)) |
400 | } | 400 | } |
401 | 401 | ||
402 | /// Computes call hierarchy candidates for the given file position. | 402 | /// 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 acd91b26c..59a74bc02 100644 --- a/crates/ide/src/syntax_highlighting/injection.rs +++ b/crates/ide/src/syntax_highlighting/injection.rs | |||
@@ -3,8 +3,8 @@ | |||
3 | use std::{collections::BTreeMap, convert::TryFrom}; | 3 | use std::{collections::BTreeMap, convert::TryFrom}; |
4 | 4 | ||
5 | use ast::{HasQuotes, HasStringValue}; | 5 | use ast::{HasQuotes, HasStringValue}; |
6 | use call_info::ActiveParameter; | ||
7 | use hir::Semantics; | 6 | use hir::Semantics; |
7 | use ide_db::call_info::ActiveParameter; | ||
8 | use itertools::Itertools; | 8 | use itertools::Itertools; |
9 | use syntax::{ast, AstToken, SyntaxNode, SyntaxToken, TextRange, TextSize}; | 9 | use syntax::{ast, AstToken, SyntaxNode, SyntaxToken, TextRange, TextSize}; |
10 | 10 | ||
diff --git a/crates/ide_db/Cargo.toml b/crates/ide_db/Cargo.toml index 320fb15e5..3ff7a1a6a 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" } | |||
29 | # ide should depend only on the top-level `hir` package. if you need | 29 | # ide should depend only on the top-level `hir` package. if you need |
30 | # something from some `hir_xxx` subpackage, reexport the API via `hir`. | 30 | # something from some `hir_xxx` subpackage, reexport the API via `hir`. |
31 | hir = { path = "../hir", version = "0.0.0" } | 31 | hir = { path = "../hir", version = "0.0.0" } |
32 | |||
33 | [dev-dependencies] | ||
34 | expect-test = "1.0" | ||
diff --git a/crates/call_info/src/lib.rs b/crates/ide_db/src/call_info.rs index c45406c25..83a602b9a 100644 --- a/crates/call_info/src/lib.rs +++ b/crates/ide_db/src/call_info.rs | |||
@@ -2,7 +2,6 @@ | |||
2 | use base_db::FilePosition; | 2 | use base_db::FilePosition; |
3 | use either::Either; | 3 | use either::Either; |
4 | use hir::{HasAttrs, HirDisplay, Semantics, Type}; | 4 | use hir::{HasAttrs, HirDisplay, Semantics, Type}; |
5 | use ide_db::RootDatabase; | ||
6 | use stdx::format_to; | 5 | use stdx::format_to; |
7 | use syntax::{ | 6 | use syntax::{ |
8 | ast::{self, ArgListOwner}, | 7 | ast::{self, ArgListOwner}, |
@@ -10,6 +9,8 @@ use syntax::{ | |||
10 | }; | 9 | }; |
11 | use test_utils::mark; | 10 | use test_utils::mark; |
12 | 11 | ||
12 | use crate::RootDatabase; | ||
13 | |||
13 | /// Contains information about a call site. Specifically the | 14 | /// Contains information about a call site. Specifically the |
14 | /// `FunctionSignature`and current parameter. | 15 | /// `FunctionSignature`and current parameter. |
15 | #[derive(Debug)] | 16 | #[derive(Debug)] |
@@ -228,9 +229,9 @@ impl FnCallNode { | |||
228 | 229 | ||
229 | #[cfg(test)] | 230 | #[cfg(test)] |
230 | mod tests { | 231 | mod tests { |
232 | use crate::RootDatabase; | ||
231 | use base_db::{fixture::ChangeFixture, FilePosition}; | 233 | use base_db::{fixture::ChangeFixture, FilePosition}; |
232 | use expect_test::{expect, Expect}; | 234 | use expect_test::{expect, Expect}; |
233 | use ide_db::RootDatabase; | ||
234 | use test_utils::{mark, RangeOrOffset}; | 235 | use test_utils::{mark, RangeOrOffset}; |
235 | 236 | ||
236 | /// Creates analysis from a multi-file fixture, returns positions marked with <|>. | 237 | /// Creates analysis from a multi-file fixture, returns positions marked with <|>. |
@@ -249,7 +250,7 @@ mod tests { | |||
249 | 250 | ||
250 | fn check(ra_fixture: &str, expect: Expect) { | 251 | fn check(ra_fixture: &str, expect: Expect) { |
251 | let (db, position) = position(ra_fixture); | 252 | let (db, position) = position(ra_fixture); |
252 | let call_info = crate::call_info(&db, position); | 253 | let call_info = crate::call_info::call_info(&db, position); |
253 | let actual = match call_info { | 254 | let actual = match call_info { |
254 | Some(call_info) => { | 255 | Some(call_info) => { |
255 | let docs = match &call_info.doc { | 256 | let docs = match &call_info.doc { |
diff --git a/crates/ide_db/src/lib.rs b/crates/ide_db/src/lib.rs index 88f74265c..303f7c964 100644 --- a/crates/ide_db/src/lib.rs +++ b/crates/ide_db/src/lib.rs | |||
@@ -12,6 +12,7 @@ pub mod imports_locator; | |||
12 | pub mod source_change; | 12 | pub mod source_change; |
13 | pub mod ty_filter; | 13 | pub mod ty_filter; |
14 | pub mod traits; | 14 | pub mod traits; |
15 | pub mod call_info; | ||
15 | 16 | ||
16 | use std::{fmt, sync::Arc}; | 17 | use std::{fmt, sync::Arc}; |
17 | 18 | ||