Deserialize more LSP inlay hint information

This commit is contained in:
Kirill Bulatov 2023-06-13 16:34:38 +03:00
parent f155f5ded7
commit 8acc5cf8f4
4 changed files with 56 additions and 7 deletions

View file

@ -332,10 +332,35 @@ pub struct InlayHint {
pub buffer_id: u64,
pub position: Anchor,
pub label: InlayHintLabel,
pub kind: Option<String>,
pub kind: Option<InlayHintKind>,
pub padding_left: bool,
pub padding_right: bool,
pub tooltip: Option<InlayHintTooltip>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum InlayHintKind {
Type,
Parameter,
}
impl InlayHintKind {
pub fn from_name(name: &str) -> Option<Self> {
match name {
"type" => Some(InlayHintKind::Type),
"parameter" => Some(InlayHintKind::Parameter),
_ => None,
}
}
pub fn name(&self) -> &'static str {
match self {
InlayHintKind::Type => "type",
InlayHintKind::Parameter => "parameter",
}
}
}
impl InlayHint {
pub fn text(&self) -> String {
match &self.label {