question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

0.28.8: malformed JSON response to `initialize` message

See original GitHub issue

Using 0.28.8, the JSON that comes back from an initialize message looks like this:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "capabilities": {
            "textDocumentSync": {
                "openClose": true,
                "change": 2,
                "willSave": false,
                "willSaveWaitUntil": false,
                "save": true
            },
            "completionProvider": {
                "triggerCharacters": [
                    ".",
                    "'",
                    "\""
                ],
                "resolveProvider": true
            },
            "hoverProvider": true,
            "signatureHelpProvider": {
                "triggerCharacters": [
                    "(",
                    ","
                ]
            },
            "declarationProvider": null,
            "definitionProvider": true,
            "typeDefinitionProvider": null,
            "implementationProvider": null,
            "referencesProvider": true,
            "documentHighlightProvider": true,
            "documentSymbolProvider": true,
            "codeActionProvider": {
                "codeActionKinds": [
                    "refactor.inline",
                    "refactor.extract"
                ]
            },
            "codeLensProvider": null,
            "documentLinkProvider": null,
            "colorProvider": null,
            "documentFormattingProvider": null,
            "documentRangeFormattingProvider": null,
            "documentOnTypeFormattingProvider": null,
            "renameProvider": true,
            "foldingRangeProvider": null,
            "executeCommandProvider": {
                "commands": []
            },
            "selectionRangeProvider": null,
            "workspaceSymbolProvider": true,
            "workspace": {
                "workspaceFolders": {
                    "supported": true,
                    "changeNotifications": true
                }
            }
        }
    }
}

The null values for declarationProvider and others aren’t correct. According to the spec, those values should be true or false, and null isn’t translatable to a Boolean.

Because those keys are optional, it may be better to omit them entirely rather than reporting null; but if that’s not an option, false is probably a better choice.

This appears to be a regression from previous versions, which omitted those keys.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
dimblebycommented, May 6, 2021

pygls fix is now released in their 0.10.3

1reaction
siegelcommented, May 7, 2021

@pappasam Yes! It appears to be resolved; I’m not seeing any null values coming back.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Receiving a Malformed JSON Error When Using API Doc
Cause. The malformed JSON error means that the format of the API call is incorrect.
Read more >
Convert invalid json into valid json - Stack Overflow
(This script only works with the invalid JSON described above, otherwise the pattern has to be changed.) === UPDATE === $sInvalidJson = '{preOpen:"900",preClose ......
Read more >
Malformed JSON Message | Imperva
Malformed JSON alerts may indicate manual intervention in the request. Most applications and valid communication generate valid JSON text. Thus an occurrence of ......
Read more >
Error: Malformed JSON: Expected '{' at the beginning of object
Error: Malformed JSON: Expected '{' at the beginning of object. Any idea to resolve this issue?
Read more >
JSON::Parse - Parse JSON - metacpan.org
A function "read_json" reads JSON from a file, and there is a safer version of "parse_json" called "parse_json_safe" which doesn't throw exceptions. For...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found