summaryrefslogtreecommitdiff
path: root/support/texlab/crates/hover/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'support/texlab/crates/hover/src/lib.rs')
-rw-r--r--support/texlab/crates/hover/src/lib.rs34
1 files changed, 10 insertions, 24 deletions
diff --git a/support/texlab/crates/hover/src/lib.rs b/support/texlab/crates/hover/src/lib.rs
index 88be3b919a..bd16be3282 100644
--- a/support/texlab/crates/hover/src/lib.rs
+++ b/support/texlab/crates/hover/src/lib.rs
@@ -8,30 +8,16 @@ mod string_ref;
use base_db::{
data::{BibtexEntryType, BibtexFieldType},
util::RenderedLabel,
- Document, Project, Workspace,
+ FeatureParams,
};
use rowan::{TextRange, TextSize};
#[derive(Debug)]
-pub struct HoverParams<'db> {
- pub document: &'db Document,
- pub project: Project<'db>,
- pub workspace: &'db Workspace,
+pub struct HoverParams<'a> {
+ pub feature: FeatureParams<'a>,
pub offset: TextSize,
}
-impl<'db> HoverParams<'db> {
- pub fn new(workspace: &'db Workspace, document: &'db Document, offset: TextSize) -> Self {
- let project = workspace.project(document);
- Self {
- document,
- project,
- workspace,
- offset,
- }
- }
-}
-
#[derive(Debug, Clone)]
pub struct Hover<'db> {
pub range: TextRange,
@@ -48,13 +34,13 @@ pub enum HoverData<'db> {
StringRef(String),
}
-pub fn find<'db>(params: &'db HoverParams<'db>) -> Option<Hover<'db>> {
- citation::find_hover(params)
- .or_else(|| package::find_hover(params))
- .or_else(|| entry_type::find_hover(params))
- .or_else(|| field_type::find_hover(params))
- .or_else(|| label::find_hover(params))
- .or_else(|| string_ref::find_hover(params))
+pub fn find(params: HoverParams) -> Option<Hover> {
+ citation::find_hover(&params)
+ .or_else(|| package::find_hover(&params))
+ .or_else(|| entry_type::find_hover(&params))
+ .or_else(|| field_type::find_hover(&params))
+ .or_else(|| label::find_hover(&params))
+ .or_else(|| string_ref::find_hover(&params))
}
#[cfg(test)]