mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Implement proposed CallHierarchy feature
See: https://github.com/microsoft/vscode-languageserver-node/blob/master/protocol/src/protocol.callHierarchy.proposed.ts
This commit is contained in:
parent
928ecd069a
commit
1b19a8aa5e
11 changed files with 502 additions and 15 deletions
|
@ -24,6 +24,7 @@ mod goto_definition;
|
|||
mod goto_type_definition;
|
||||
mod extend_selection;
|
||||
mod hover;
|
||||
mod call_hierarchy;
|
||||
mod call_info;
|
||||
mod syntax_highlighting;
|
||||
mod parent_module;
|
||||
|
@ -62,6 +63,7 @@ use crate::{db::LineIndexDatabase, display::ToNav, symbol_index::FileSymbol};
|
|||
|
||||
pub use crate::{
|
||||
assists::{Assist, AssistId},
|
||||
call_hierarchy::CallItem,
|
||||
change::{AnalysisChange, LibraryData},
|
||||
completion::{CompletionItem, CompletionItemKind, InsertTextFormat},
|
||||
diagnostics::Severity,
|
||||
|
@ -412,6 +414,24 @@ impl Analysis {
|
|||
self.with_db(|db| call_info::call_info(db, position))
|
||||
}
|
||||
|
||||
/// Computes call hierarchy candidates for the given file position.
|
||||
pub fn call_hierarchy(
|
||||
&self,
|
||||
position: FilePosition,
|
||||
) -> Cancelable<Option<RangeInfo<Vec<NavigationTarget>>>> {
|
||||
self.with_db(|db| call_hierarchy::call_hierarchy(db, position))
|
||||
}
|
||||
|
||||
/// Computes incoming calls for the given file position.
|
||||
pub fn incoming_calls(&self, position: FilePosition) -> Cancelable<Option<Vec<CallItem>>> {
|
||||
self.with_db(|db| call_hierarchy::incoming_calls(db, position))
|
||||
}
|
||||
|
||||
/// Computes incoming calls for the given file position.
|
||||
pub fn outgoing_calls(&self, position: FilePosition) -> Cancelable<Option<Vec<CallItem>>> {
|
||||
self.with_db(|db| call_hierarchy::outgoing_calls(db, position))
|
||||
}
|
||||
|
||||
/// Returns a `mod name;` declaration which created the current module.
|
||||
pub fn parent_module(&self, position: FilePosition) -> Cancelable<Vec<NavigationTarget>> {
|
||||
self.with_db(|db| parent_module::parent_module(db, position))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue