Skip to content

chore: remove DiagnosticRequestParams workaround when lsp-types fixes upstream null serialization #166

Description

@bug-ops

Description

DiagnosticRequestParams in crates/mcpls-core/src/bridge/translator.rs is a private workaround struct that duplicates lsp_types::DocumentDiagnosticParams. It exists because the upstream crate (lsp-types 0.97.0) lacks #[serde(skip_serializing_if = "Option::is_none")] on its identifier and previous_result_id fields, causing those fields to serialize as JSON null instead of being omitted.

tsgo's strict Go LSP decoder rejects null for these fields (InvalidParams: null value is not allowed for field "identifier"), which is what motivated the workaround introduced in #147.

Notably, the same lsp-types file already applies skip_serializing_if on DiagnosticOptions.identifier — the omission on DocumentDiagnosticParams appears to be an oversight.

Expected Behavior

Once gluon-lang/lsp-types adds #[serde(skip_serializing_if = "Option::is_none")] to DocumentDiagnosticParams.identifier and DocumentDiagnosticParams.previous_result_id, we can:

  1. Bump the lsp-types dependency to the fixed version
  2. Remove DiagnosticRequestParams and diagnostic_request_params() from translator.rs
  3. Restore direct use of lsp_types::DocumentDiagnosticParams

Action

  • Track the upstream fix in gluon-lang/lsp-types
  • Bump lsp-types in Cargo.toml once the fix is released
  • Remove DiagnosticRequestParams workaround from translator.rs
  • Remove the test_diagnostic_request_params_omit_optional_null_fields test (covered by upstream type guarantees)

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions