Skip to content

Commit

Permalink
refactor: simplify inlay_hints
Browse files Browse the repository at this point in the history
  • Loading branch information
washanhanzi committed Sep 23, 2024
1 parent 572e67f commit 6d59fb9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
9 changes: 2 additions & 7 deletions src/decoration/inlay_hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
21 changes: 2 additions & 19 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
}

Expand Down

0 comments on commit 6d59fb9

Please sign in to comment.