Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ccls: "expected array for /context/diagnostics[0]/relatedInformation" #690

Closed
hpdeifel opened this issue Mar 4, 2019 · 2 comments
Closed

Comments

@hpdeifel
Copy link
Contributor

hpdeifel commented Mar 4, 2019

Describe the bug
ccls complains that /context/diagnostics[0]/relatedInformation in the document/codeAction request is not an array. ccls originally sends [] in the diagnostics and this somehow gets transformed to null when echoed back to the server.

To Reproduce
Go to a line with diagnostics and code actions in a ccls-project buffer.

Which Language Server did you use
ccls master from yesterday.

OS
GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5) of 2019-03-04

IO

>>> ccls:7828(async)
Content-Length: 2888

{
  "jsonrpc": "2.0",
  "method": "textDocument/codeAction",
  "params": {
    "textDocument": {
      "uri": "HIDDEN"
    },
    "range": {
      "start": {
        "line": 96,
        "character": 0
      },
      "end": {
        "line": 96,
        "character": 66
      }
    },
    "context": {
      "diagnostics": [
        {
          "relatedInformation": null,
          "message": "use of undeclared identifier 'td'",
          "source": "ccls",
          "code": 2,
          "severity": 1,
          "range": {
            "end": {
              "character": 2,
              "line": 96
            },
            "start": {
              "character": 0,
              "line": 96
            }
          }
        },
        {
          "relatedInformation": null,
          "message": "HIDDEN",
          "source": "ccls",
          "code": 2,
          "severity": 1,
          "range": {
            "end": {
              "character": 37,
              "line": 96
            },
            "start": {
              "character": 31,
              "line": 96
            }
          }
        },
        ...
      ]
    }
  },
  "id": 2409
}

<<<< ccls:7828
{
  "jsonrpc": "2.0",
  "id": 2409,
  "error": {
    "code": -32602,
    "message": "invalid params of textDocument/codeAction: expected array for /context/diagnostics[0]/relatedInformation"
  }
}

And the original diagnostics look like so:

<<<< ccls:7828
{
  "jsonrpc": "2.0",
  "method": "textDocument/publishDiagnostics",
  "params": {
    "uri": "HIDDEN",
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 84,
            "character": 1
          },
          "end": {
            "line": 84,
            "character": 12
          }
        },
        "severity": 1,
        "code": 2,
        "source": "ccls",
        "message": "HIDDEN",
        "relatedInformation": []
      },
      {
        "range": {
          "start": {
            "line": 96,
            "character": 0
          },
          "end": {
            "line": 96,
            "character": 2
          }
        },
        "severity": 1,
        "code": 2,
        "source": "ccls",
        "message": "use of undeclared identifier 'td'",
        "relatedInformation": []
      },
      ...
    ]
  }
}

@yyoncho
Copy link
Member

yyoncho commented Mar 4, 2019

Duplicate of #395 will be fixed with #210

@yyoncho yyoncho closed this as completed Mar 4, 2019
@yyoncho
Copy link
Member

yyoncho commented Mar 4, 2019

@hpdeifel PR at #691 . I will appreciate help with testing the PR .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants