Skip to content

Is ValueSet decoding too strict? #29

@jonsterling

Description

@jonsterling

The Helix editor language client sends an empty dictionary {} for this params.capabilities.textDocument.completion.completionItemKind during initialisation, but the LanguageServerProtocol library expects this dictionary to have a valueSet field if it is sent at all.

This means that when the Helix language client attempts to initialise my server, it receives the following decoding error:

2025-09-20T21:13:26.786 helix_lsp::transport [ERROR] pterodactyl-lsp err <- "2025-09-20T21:13:26+0100 error org.jonmsterling.pterodactyl: [Pterodactyl] Received error: keyNotFound(CodingKeys(stringValue: \"valueSet\", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: \"params\", intValue: nil), CodingKeys(stringValue: \"capabilities\", intValue: nil), CodingKeys(stringValue: \"textDocument\", intValue: nil), CodingKeys(stringValue: \"completion\", intValue: nil), CodingKeys(stringValue: \"completionItemKind\", intValue: nil)], debugDescription: \"No value associated with key CodingKeys(stringValue: \\\"valueSet\\\", intValue: nil) (\\\"valueSet\\\").\", underlyingError: nil))\n"

Now, after having a look at the LSP specification for CompletionClientCapabilities, I think that it is intended that both

...completionItemKind = {}

and

...completionItemKind = { valueSet = ...}

are intended to be valid according to the specification. There are so many levels of optionality here. Perhaps the solution is to change the swift ValueSet struct to have an optional valueSet member.

What do you think? P.S. thanks for the great library! It is really speeding me up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions