Skip to content

Can't initialize tsgo: lsp-mode sends null where the spec wants an object or nothing #5081

Description

@Macavirus

I tried using the built-in tsgo client (typescript-go, @typescript/native-preview). It's a strict JSON decoder and rejects two things lsp-mode sends, so it never initializes.

First, the client capabilities contain (inlineCompletion . ()) in lsp-mode.el, which serializes as "inlineCompletion": null. The spec says that field is an optional object, so it should either be omitted or be an object. tsgo errors with:

InvalidParams: ... within "/capabilities/textDocument/inlineCompletion": null value is not allowed

Second, paramless requests like shutdown go out as "params": null, because lsp--make-notification always includes :params. JSON-RPC says params must be omitted or structured, so tsgo errors on restart too:

InvalidParams: expected empty, got: null

Both seem like one-line fixes: serialize inlineCompletion as an empty object (like the neighboring entries), and drop :params from the message when nil.

I'm working around both locally with advice, happy to send a PR if you'd take one. Related: #4854.

Tested with lsp-mode master and tsgo 7.0.0-dev.20260609.1.

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