aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorIgor Aleksanov <[email protected]>2020-10-24 09:07:10 +0100
committerIgor Aleksanov <[email protected]>2020-10-24 09:07:10 +0100
commitb6ea56ea091ad1dbd765831d8dfe79e4d3cdf004 (patch)
treefe4de54d78bbafd5de62f008b25c49fa22041146 /crates
parent8d3d509af77756758cea14cc4939d099b4f95993 (diff)
Make call_info a part of ide_db
Diffstat (limited to 'crates')
-rw-r--r--crates/call_info/Cargo.toml26
-rw-r--r--crates/completion/Cargo.toml1
-rw-r--r--crates/completion/src/completion_context.rs3
-rw-r--r--crates/ide/Cargo.toml1
-rw-r--r--crates/ide/src/call_hierarchy.rs2
-rw-r--r--crates/ide/src/lib.rs4
-rw-r--r--crates/ide/src/syntax_highlighting/injection.rs2
-rw-r--r--crates/ide_db/Cargo.toml3
-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.rs1
10 files changed, 13 insertions, 37 deletions
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]
2name = "call_info"
3version = "0.0.0"
4description = "TBD"
5license = "MIT OR Apache-2.0"
6authors = ["rust-analyzer developers"]
7edition = "2018"
8
9[lib]
10doctest = false
11
12[dependencies]
13either = "1.5.3"
14
15stdx = { path = "../stdx", version = "0.0.0" }
16syntax = { path = "../syntax", version = "0.0.0" }
17base_db = { path = "../base_db", version = "0.0.0" }
18ide_db = { path = "../ide_db", version = "0.0.0" }
19test_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`.
23hir = { path = "../hir", version = "0.0.0" }
24
25[dev-dependencies]
26expect-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" }
21ide_db = { path = "../ide_db", version = "0.0.0" } 21ide_db = { path = "../ide_db", version = "0.0.0" }
22profile = { path = "../profile", version = "0.0.0" } 22profile = { path = "../profile", version = "0.0.0" }
23test_utils = { path = "../test_utils", version = "0.0.0" } 23test_utils = { path = "../test_utils", version = "0.0.0" }
24call_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
3use base_db::{FilePosition, SourceDatabase}; 3use base_db::{FilePosition, SourceDatabase};
4use call_info::ActiveParameter;
5use hir::{Local, ScopeDef, Semantics, SemanticsScope, Type}; 4use hir::{Local, ScopeDef, Semantics, SemanticsScope, Type};
6use ide_db::RootDatabase; 5use ide_db::{call_info::ActiveParameter, RootDatabase};
7use syntax::{ 6use 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" }
30test_utils = { path = "../test_utils", version = "0.0.0" } 30test_utils = { path = "../test_utils", version = "0.0.0" }
31assists = { path = "../assists", version = "0.0.0" } 31assists = { path = "../assists", version = "0.0.0" }
32ssr = { path = "../ssr", version = "0.0.0" } 32ssr = { path = "../ssr", version = "0.0.0" }
33call_info = { path = "../call_info", version = "0.0.0" }
34completion = { path = "../completion", version = "0.0.0" } 33completion = { 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
3use indexmap::IndexMap; 3use indexmap::IndexMap;
4 4
5use call_info::FnCallNode;
6use hir::Semantics; 5use hir::Semantics;
6use ide_db::call_info::FnCallNode;
7use ide_db::RootDatabase; 7use ide_db::RootDatabase;
8use syntax::{ast, match_ast, AstNode, TextRange}; 8use 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};
83pub use call_info::CallInfo;
84pub use completion::{ 83pub use completion::{
85 CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat, 84 CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat,
86}; 85};
86pub use ide_db::call_info::CallInfo;
87 87
88pub use assists::{ 88pub 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 @@
3use std::{collections::BTreeMap, convert::TryFrom}; 3use std::{collections::BTreeMap, convert::TryFrom};
4 4
5use ast::{HasQuotes, HasStringValue}; 5use ast::{HasQuotes, HasStringValue};
6use call_info::ActiveParameter;
7use hir::Semantics; 6use hir::Semantics;
7use ide_db::call_info::ActiveParameter;
8use itertools::Itertools; 8use itertools::Itertools;
9use syntax::{ast, AstToken, SyntaxNode, SyntaxToken, TextRange, TextSize}; 9use 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`.
31hir = { path = "../hir", version = "0.0.0" } 31hir = { path = "../hir", version = "0.0.0" }
32
33[dev-dependencies]
34expect-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 @@
2use base_db::FilePosition; 2use base_db::FilePosition;
3use either::Either; 3use either::Either;
4use hir::{HasAttrs, HirDisplay, Semantics, Type}; 4use hir::{HasAttrs, HirDisplay, Semantics, Type};
5use ide_db::RootDatabase;
6use stdx::format_to; 5use stdx::format_to;
7use syntax::{ 6use syntax::{
8 ast::{self, ArgListOwner}, 7 ast::{self, ArgListOwner},
@@ -10,6 +9,8 @@ use syntax::{
10}; 9};
11use test_utils::mark; 10use test_utils::mark;
12 11
12use 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)]
230mod tests { 231mod 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;
12pub mod source_change; 12pub mod source_change;
13pub mod ty_filter; 13pub mod ty_filter;
14pub mod traits; 14pub mod traits;
15pub mod call_info;
15 16
16use std::{fmt, sync::Arc}; 17use std::{fmt, sync::Arc};
17 18