diff options
Diffstat (limited to 'crates/ra_analysis/src/lib.rs')
-rw-r--r-- | crates/ra_analysis/src/lib.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index 1e26a2889..1904ff884 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs | |||
@@ -21,6 +21,7 @@ mod runnables; | |||
21 | 21 | ||
22 | mod extend_selection; | 22 | mod extend_selection; |
23 | mod syntax_highlighting; | 23 | mod syntax_highlighting; |
24 | mod hover; | ||
24 | 25 | ||
25 | use std::{fmt, sync::Arc}; | 26 | use std::{fmt, sync::Arc}; |
26 | 27 | ||
@@ -260,6 +261,18 @@ impl NavigationTarget { | |||
260 | } | 261 | } |
261 | } | 262 | } |
262 | 263 | ||
264 | #[derive(Debug)] | ||
265 | pub struct RangeInfo<T> { | ||
266 | pub range: TextRange, | ||
267 | pub info: T, | ||
268 | } | ||
269 | |||
270 | impl<T> RangeInfo<T> { | ||
271 | fn new(range: TextRange, info: T) -> RangeInfo<T> { | ||
272 | RangeInfo { range, info } | ||
273 | } | ||
274 | } | ||
275 | |||
263 | /// Result of "goto def" query. | 276 | /// Result of "goto def" query. |
264 | #[derive(Debug)] | 277 | #[derive(Debug)] |
265 | pub struct ReferenceResolution { | 278 | pub struct ReferenceResolution { |
@@ -394,6 +407,10 @@ impl Analysis { | |||
394 | pub fn doc_text_for(&self, nav: NavigationTarget) -> Cancelable<Option<String>> { | 407 | pub fn doc_text_for(&self, nav: NavigationTarget) -> Cancelable<Option<String>> { |
395 | self.db.doc_text_for(nav) | 408 | self.db.doc_text_for(nav) |
396 | } | 409 | } |
410 | /// Returns a short text descrbing element at position. | ||
411 | pub fn hover(&self, position: FilePosition) -> Cancelable<Option<RangeInfo<String>>> { | ||
412 | hover::hover(&*self.db, position) | ||
413 | } | ||
397 | /// Returns a `mod name;` declaration which created the current module. | 414 | /// Returns a `mod name;` declaration which created the current module. |
398 | pub fn parent_module(&self, position: FilePosition) -> Cancelable<Vec<NavigationTarget>> { | 415 | pub fn parent_module(&self, position: FilePosition) -> Cancelable<Vec<NavigationTarget>> { |
399 | self.db.parent_module(position) | 416 | self.db.parent_module(position) |