diff options
Diffstat (limited to 'crates/ra_analysis/src/lib.rs')
-rw-r--r-- | crates/ra_analysis/src/lib.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index ec400ffe2..771a349c8 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs | |||
@@ -22,6 +22,7 @@ mod symbol_index; | |||
22 | 22 | ||
23 | mod extend_selection; | 23 | mod extend_selection; |
24 | mod hover; | 24 | mod hover; |
25 | mod call_info; | ||
25 | mod syntax_highlighting; | 26 | mod syntax_highlighting; |
26 | 27 | ||
27 | use std::{fmt, sync::Arc}; | 28 | use std::{fmt, sync::Arc}; |
@@ -39,7 +40,6 @@ pub use crate::{ | |||
39 | completion::{CompletionItem, CompletionItemKind, InsertText}, | 40 | completion::{CompletionItem, CompletionItemKind, InsertText}, |
40 | runnables::{Runnable, RunnableKind}, | 41 | runnables::{Runnable, RunnableKind}, |
41 | }; | 42 | }; |
42 | pub use hir::FnSignatureInfo; | ||
43 | pub use ra_editor::{Fold, FoldKind, HighlightedRange, LineIndex, Severity, StructureNode}; | 43 | pub use ra_editor::{Fold, FoldKind, HighlightedRange, LineIndex, Severity, StructureNode}; |
44 | 44 | ||
45 | pub use ra_db::{ | 45 | pub use ra_db::{ |
@@ -272,6 +272,14 @@ impl<T> RangeInfo<T> { | |||
272 | } | 272 | } |
273 | } | 273 | } |
274 | 274 | ||
275 | #[derive(Debug)] | ||
276 | pub struct CallInfo { | ||
277 | pub label: String, | ||
278 | pub doc: Option<String>, | ||
279 | pub parameters: Vec<String>, | ||
280 | pub active_parameter: Option<usize>, | ||
281 | } | ||
282 | |||
275 | /// `AnalysisHost` stores the current state of the world. | 283 | /// `AnalysisHost` stores the current state of the world. |
276 | #[derive(Debug, Default)] | 284 | #[derive(Debug, Default)] |
277 | pub struct AnalysisHost { | 285 | pub struct AnalysisHost { |
@@ -391,6 +399,10 @@ impl Analysis { | |||
391 | pub fn hover(&self, position: FilePosition) -> Cancelable<Option<RangeInfo<String>>> { | 399 | pub fn hover(&self, position: FilePosition) -> Cancelable<Option<RangeInfo<String>>> { |
392 | hover::hover(&*self.db, position) | 400 | hover::hover(&*self.db, position) |
393 | } | 401 | } |
402 | /// Computes parameter information for the given call expression. | ||
403 | pub fn call_info(&self, position: FilePosition) -> Cancelable<Option<CallInfo>> { | ||
404 | call_info::call_info(&*self.db, position) | ||
405 | } | ||
394 | /// Returns a `mod name;` declaration which created the current module. | 406 | /// Returns a `mod name;` declaration which created the current module. |
395 | pub fn parent_module(&self, position: FilePosition) -> Cancelable<Vec<NavigationTarget>> { | 407 | pub fn parent_module(&self, position: FilePosition) -> Cancelable<Vec<NavigationTarget>> { |
396 | self.db.parent_module(position) | 408 | self.db.parent_module(position) |
@@ -425,13 +437,6 @@ impl Analysis { | |||
425 | pub fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> { | 437 | pub fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> { |
426 | self.db.diagnostics(file_id) | 438 | self.db.diagnostics(file_id) |
427 | } | 439 | } |
428 | /// Computes parameter information for the given call expression. | ||
429 | pub fn resolve_callable( | ||
430 | &self, | ||
431 | position: FilePosition, | ||
432 | ) -> Cancelable<Option<(FnSignatureInfo, Option<usize>)>> { | ||
433 | self.db.resolve_callable(position) | ||
434 | } | ||
435 | /// Computes the type of the expression at the given position. | 440 | /// Computes the type of the expression at the given position. |
436 | pub fn type_of(&self, frange: FileRange) -> Cancelable<Option<String>> { | 441 | pub fn type_of(&self, frange: FileRange) -> Cancelable<Option<String>> { |
437 | hover::type_of(&*self.db, frange) | 442 | hover::type_of(&*self.db, frange) |