From 6d59fb9ad3e4f4c28a22b508f787013f3fb6bf14 Mon Sep 17 00:00:00 2001 From: jingyu Date: Mon, 23 Sep 2024 23:32:51 +0800 Subject: [PATCH] refactor: simplify inlay_hints --- src/decoration/inlay_hint.rs | 9 ++------- src/main.rs | 21 ++------------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/decoration/inlay_hint.rs b/src/decoration/inlay_hint.rs index 88e84d8..aa062fd 100644 --- a/src/decoration/inlay_hint.rs +++ b/src/decoration/inlay_hint.rs @@ -126,13 +126,8 @@ impl InlayHintDecoration { let hint = InlayHint { position: Position::new(range.end.line - 1, range.end.character), - label: InlayHintLabel::LabelParts(vec![InlayHintLabelPart { - value: display, - tooltip: None, - location: None, - command: None, - }]), - kind: Some(InlayHintKind::TYPE), + label: InlayHintLabel::String(display), + kind: None, text_edits: None, tooltip: None, padding_left: Some(true), diff --git a/src/main.rs b/src/main.rs index 49e7530..ce30610 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,24 +38,7 @@ impl LanguageServer for CargoAppraiser { workspace_folders: None, file_operations: None, }), - inlay_hint_provider: Some(OneOf::Right( - InlayHintServerCapabilities::RegistrationOptions( - InlayHintRegistrationOptions { - inlay_hint_options: InlayHintOptions { - resolve_provider: Some(true), - work_done_progress_options: WorkDoneProgressOptions::default(), - }, - text_document_registration_options: TextDocumentRegistrationOptions { - document_selector: Some(vec![DocumentFilter { - language: Some("toml".to_string()), - pattern: Some("**/Cargo.toml".to_string()), - scheme: None, - }]), - }, - static_registration_options: Default::default(), - }, - ), - )), + inlay_hint_provider: Some(OneOf::Left(true)), diagnostic_provider: Some(DiagnosticServerCapabilities::RegistrationOptions( DiagnosticRegistrationOptions { text_document_registration_options: TextDocumentRegistrationOptions { @@ -81,7 +64,7 @@ impl LanguageServer for CargoAppraiser { async fn initialized(&self, _: InitializedParams) { self.client - .log_message(MessageType::INFO, "server initialized again!") + .log_message(MessageType::INFO, "cargo-appraiser server initialized!") .await; }