Make call_info a part of ide_db

This commit is contained in:
Igor Aleksanov 2020-10-24 11:07:10 +03:00
parent 8d3d509af7
commit b6ea56ea09
11 changed files with 14 additions and 53 deletions

17
Cargo.lock generated
View File

@ -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",

View File

@ -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"

View File

@ -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`.

View File

@ -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,

View File

@ -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

View File

@ -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};

View File

@ -80,10 +80,10 @@ macro_rules! eprintln {
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 @@ pub fn external_docs(
/// Computes parameter information for the given call expression.
pub fn call_info(&self, position: FilePosition) -> Cancelable<Option<CallInfo>> {
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.

View File

@ -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};

View File

@ -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"

View File

@ -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 test_utils::mark;
use crate::RootDatabase;
/// Contains information about a call site. Specifically the
/// `FunctionSignature`and current parameter.
#[derive(Debug)]
@ -228,9 +229,9 @@ fn arg_list(&self) -> Option<ast::ArgList> {
#[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 @@ pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) {
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 {

View File

@ -12,6 +12,7 @@
pub mod source_change;
pub mod ty_filter;
pub mod traits;
pub mod call_info;
use std::{fmt, sync::Arc};