1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
mod label;
use base_db::{util::RenderedLabel, FeatureParams};
use rowan::{TextRange, TextSize};
pub struct InlayHintParams<'a> {
pub range: TextRange,
pub feature: FeatureParams<'a>,
}
#[derive(Debug, PartialEq, Eq)]
pub struct InlayHint<'a> {
pub offset: TextSize,
pub data: InlayHintData<'a>,
}
#[derive(Debug, PartialEq, Eq)]
pub enum InlayHintData<'a> {
LabelDefinition(RenderedLabel<'a>),
LabelReference(RenderedLabel<'a>),
}
pub fn find_all<'a>(params: InlayHintParams<'a>) -> Option<Vec<InlayHint>> {
let mut builder = InlayHintBuilder {
params,
hints: Vec::new(),
};
label::find_hints(&mut builder);
Some(builder.hints)
}
struct InlayHintBuilder<'a> {
params: InlayHintParams<'a>,
hints: Vec<InlayHint<'a>>,
}
|