mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
move hover implementation to ra_analysis
This commit is contained in:
parent
2560a9e807
commit
3ad0037f90
4 changed files with 83 additions and 67 deletions
|
@ -21,6 +21,7 @@ mod runnables;
|
|||
|
||||
mod extend_selection;
|
||||
mod syntax_highlighting;
|
||||
mod hover;
|
||||
|
||||
use std::{fmt, sync::Arc};
|
||||
|
||||
|
@ -260,6 +261,18 @@ impl NavigationTarget {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RangeInfo<T> {
|
||||
pub range: TextRange,
|
||||
pub info: T,
|
||||
}
|
||||
|
||||
impl<T> RangeInfo<T> {
|
||||
fn new(range: TextRange, info: T) -> RangeInfo<T> {
|
||||
RangeInfo { range, info }
|
||||
}
|
||||
}
|
||||
|
||||
/// Result of "goto def" query.
|
||||
#[derive(Debug)]
|
||||
pub struct ReferenceResolution {
|
||||
|
@ -394,6 +407,10 @@ impl Analysis {
|
|||
pub fn doc_text_for(&self, nav: NavigationTarget) -> Cancelable<Option<String>> {
|
||||
self.db.doc_text_for(nav)
|
||||
}
|
||||
/// Returns a short text descrbing element at position.
|
||||
pub fn hover(&self, position: FilePosition) -> Cancelable<Option<RangeInfo<String>>> {
|
||||
hover::hover(&*self.db, position)
|
||||
}
|
||||
/// Returns a `mod name;` declaration which created the current module.
|
||||
pub fn parent_module(&self, position: FilePosition) -> Cancelable<Vec<NavigationTarget>> {
|
||||
self.db.parent_module(position)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue