Skip to content

Commit

Permalink
fix: LSP initialization options (#1584)
Browse files Browse the repository at this point in the history
* fix: Allow deserializing to default values on missing fields

* fix: `params.initialization_options` is already a `Value`
  • Loading branch information
aldur authored Oct 17, 2024
1 parent 90cb015 commit 9948b1c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/clarity-lsp/src/common/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ pub fn process_mutating_request(
LspRequest::Initialize(params) => {
let initialization_options = params
.initialization_options
.and_then(|o| serde_json::from_str(o.as_str()?).ok())
.and_then(|o| serde_json::from_value(o).ok())
.unwrap_or(InitializationOptions::default());

match editor_state.try_write(|es| es.settings = initialization_options.clone()) {
Expand Down
2 changes: 1 addition & 1 deletion components/clarity-lsp/src/common/requests/capabilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use lsp_types::{
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Deserialize, Serialize, Default)]
#[serde(rename_all = "camelCase")]
#[serde(rename_all = "camelCase", default)]
pub struct InitializationOptions {
completion: bool,
pub completion_smart_parenthesis_wrap: bool,
Expand Down

0 comments on commit 9948b1c

Please sign in to comment.