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:
- Bump the
lsp-types dependency to the fixed version
- Remove
DiagnosticRequestParams and diagnostic_request_params() from translator.rs
- Restore direct use of
lsp_types::DocumentDiagnosticParams
Action
Environment
Description
DiagnosticRequestParamsincrates/mcpls-core/src/bridge/translator.rsis a private workaround struct that duplicateslsp_types::DocumentDiagnosticParams. It exists because the upstream crate (lsp-types 0.97.0) lacks#[serde(skip_serializing_if = "Option::is_none")]on itsidentifierandprevious_result_idfields, causing those fields to serialize as JSONnullinstead of being omitted.tsgo's strict Go LSP decoder rejects
nullfor these fields (InvalidParams: null value is not allowed for field "identifier"), which is what motivated the workaround introduced in #147.Notably, the same
lsp-typesfile already appliesskip_serializing_ifonDiagnosticOptions.identifier— the omission onDocumentDiagnosticParamsappears to be an oversight.Expected Behavior
Once
gluon-lang/lsp-typesadds#[serde(skip_serializing_if = "Option::is_none")]toDocumentDiagnosticParams.identifierandDocumentDiagnosticParams.previous_result_id, we can:lsp-typesdependency to the fixed versionDiagnosticRequestParamsanddiagnostic_request_params()fromtranslator.rslsp_types::DocumentDiagnosticParamsAction
gluon-lang/lsp-typeslsp-typesinCargo.tomlonce the fix is releasedDiagnosticRequestParamsworkaround fromtranslator.rstest_diagnostic_request_params_omit_optional_null_fieldstest (covered by upstream type guarantees)Environment