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

Invalid response for documentHightlight #206

Closed
laurynas-biveinis opened this issue Apr 9, 2020 · 3 comments · Fixed by #209
Closed

Invalid response for documentHightlight #206

laurynas-biveinis opened this issue Apr 9, 2020 · 3 comments · Fixed by #209

Comments

@laurynas-biveinis
Copy link

laurynas-biveinis commented Apr 9, 2020

With version 1.11.1, emacs-lsp client produces errors due to apparently incorrect documentHighlight response:

[Trace - 10:42:51 AM] Received response 'textDocument/documentHighlight - (2)' in 4ms.
Result: [
{
"range": null
},
{
"range": null
},
{
"range": null
},
{

A test script example

readonly FOO=$1
readonly BAR=$UNDEFINED/$FOO

The errors appear while navigating the second line. Downgrading to 1.9.0 avoids the issue.

Full client server LSP log
[Trace - 10:42:49 AM] Sending request 'initialize - (1)'.
Params: {
  "processId": null,
  "rootPath": "/Users/laurynas/tmp",
  "clientInfo": {
    "name": "emacs",
    "version": "GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109))\n of 2019-09-02"
  },
  "rootUri": "file:///Users/laurynas/tmp",
  "capabilities": {
    "workspace": {
      "workspaceEdit": {
        "documentChanges": true,
        "resourceOperations": [
          "create",
          "rename",
          "delete"
        ]
      },
      "applyEdit": true,
      "symbol": {
        "symbolKind": {
          "valueSet": [
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20,
            21,
            22,
            23,
            24,
            25,
            26
          ]
        }
      },
      "executeCommand": {
        "dynamicRegistration": false
      },
      "didChangeWatchedFiles": {
        "dynamicRegistration": true
      },
      "workspaceFolders": true,
      "configuration": true
    },
    "textDocument": {
      "declaration": {
        "linkSupport": true
      },
      "definition": {
        "linkSupport": true
      },
      "implementation": {
        "linkSupport": true
      },
      "typeDefinition": {
        "linkSupport": true
      },
      "synchronization": {
        "willSave": true,
        "didSave": true,
        "willSaveWaitUntil": true
      },
      "documentSymbol": {
        "symbolKind": {
          "valueSet": [
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20,
            21,
            22,
            23,
            24,
            25,
            26
          ]
        },
        "hierarchicalDocumentSymbolSupport": true
      },
      "formatting": {
        "dynamicRegistration": true
      },
      "rangeFormatting": {
        "dynamicRegistration": true
      },
      "rename": {
        "dynamicRegistration": true,
        "prepareSupport": true
      },
      "semanticHighlightingCapabilities": {
        "semanticHighlighting": false
      },
      "codeAction": {
        "dynamicRegistration": true,
        "isPreferredSupport": true,
        "codeActionLiteralSupport": {
          "codeActionKind": {
            "valueSet": [
              "",
              "quickfix",
              "refactor",
              "refactor.extract",
              "refactor.inline",
              "refactor.rewrite",
              "source",
              "source.organizeImports"
            ]
          }
        }
      },
      "completion": {
        "completionItem": {
          "snippetSupport": true,
          "documentationFormat": [
            "markdown"
          ]
        },
        "contextSupport": true
      },
      "signatureHelp": {
        "signatureInformation": {
          "parameterInformation": {
            "labelOffsetSupport": true
          }
        }
      },
      "documentLink": {
        "dynamicRegistration": true,
        "tooltipSupport": true
      },
      "hover": {
        "contentFormat": [
          "markdown",
          "plaintext"
        ]
      },
      "foldingRange": {
        "dynamicRegistration": true,
        "rangeLimit": null,
        "lineFoldingOnly": false
      },
      "callHierarchy": {
        "dynamicRegistration": false
      },
      "publishDiagnostics": {
        "relatedInformation": true,
        "tagSupport": {
          "valueSet": [
            1,
            2
          ]
        },
        "versionSupport": true
      }
    },
    "window": {
      "workDoneProgress": true
    }
  },
  "initializationOptions": null,
  "workDoneToken": "1"
}


[Trace - 10:42:50 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Initialized server v. 1.11.1 for file:///Users/laurynas/tmp",
  "type": 4
}


[Trace - 10:42:50 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Analyzing files matching glob \"**/*@(.sh|.inc|.bash|.command)\" inside /Users/laurynas/tmp",
  "type": 4
}


[Trace - 10:42:50 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Glob resolved with 4 files after 0.108 seconds",
  "type": 4
}


[Trace - 10:42:50 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Analyzing file:///Users/laurynas/tmp/dotfiles/emacs-helm.sh",
  "type": 4
}


[Trace - 10:42:50 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Analyzing file:///Users/laurynas/tmp/dotfiles/emacs/emacs/elpa/auctex-12.1.2/autogen.sh",
  "type": 4
}


[Trace - 10:42:50 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Analyzing file:///Users/laurynas/tmp/dotfiles/scripts/usr/bin/library.bash",
  "type": 4
}


[Trace - 10:42:50 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Analyzing file:///Users/laurynas/tmp/test.sh",
  "type": 4
}


[Trace - 10:42:50 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Analyzer finished after 0.12 seconds",
  "type": 4
}


[Trace - 10:42:50 AM] Received response 'initialize - (1)' in 854ms.
Result: {
  "capabilities": {
    "referencesProvider": true,
    "workspaceSymbolProvider": true,
    "documentSymbolProvider": true,
    "definitionProvider": true,
    "documentHighlightProvider": true,
    "hoverProvider": true,
    "completionProvider": {
      "resolveProvider": true
    },
    "textDocumentSync": 1
  }
}


[Trace - 10:42:50 AM] Sending notification 'initialized'.
Params: {
}


[Trace - 10:42:50 AM] Sending notification 'textDocument/didOpen'.
Params: {
  "textDocument": {
    "uri": "file:///Users/laurynas/tmp/test.sh",
    "languageId": "shellscript",
    "version": 0,
    "text": "readonly FOO=$1\nreadonly BAR=$UNDEFINED/$FOO\n"
  }
}


[Trace - 10:42:51 AM] Sending request 'textDocument/documentHighlight - (2)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/laurynas/tmp/test.sh"
  },
  "position": {
    "line": 0,
    "character": 0
  }
}


[Trace - 10:42:51 AM] Received notification 'window/logMessage'.
Params: {
  "message": "onDocumentHighlight 0:0 ",
  "type": 4
}


[Trace - 10:42:51 AM] Received response 'textDocument/documentHighlight - (2)' in 4ms.
Result: [
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  }
]


[Trace - 10:44:32 AM] Sending request 'textDocument/documentHighlight - (3)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/laurynas/tmp/test.sh"
  },
  "position": {
    "line": 2,
    "character": 0
  }
}


[Trace - 10:44:32 AM] Sending notification '$/cancelRequest'.
Params: {
  "id": 3
}


[Trace - 10:44:32 AM] Sending request 'textDocument/documentHighlight - (4)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/laurynas/tmp/test.sh"
  },
  "position": {
    "line": 2,
    "character": 0
  }
}


[Trace - 10:44:32 AM] Received notification 'window/logMessage'.
Params: {
  "message": "onDocumentHighlight 2:0 ",
  "type": 4
}


[Trace - 10:44:32 AM] Received response 'nil - (3)' in 0ms.
Result: [
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  }
]


[Trace - 10:44:32 AM] Received notification 'window/logMessage'.
Params: {
  "message": "onDocumentHighlight 2:0 ",
  "type": 4
}


[Trace - 10:44:32 AM] Received response 'textDocument/documentHighlight - (4)' in 2ms.
Result: [
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  }
]


[Trace - 10:44:32 AM] Sending request 'textDocument/hover - (5)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/laurynas/tmp/test.sh"
  },
  "position": {
    "line": 2,
    "character": 0
  }
}


[Trace - 10:44:32 AM] Received notification 'window/logMessage'.
Params: {
  "message": "onHover 2:0 ",
  "type": 4
}


[Trace - 10:44:32 AM] Received response 'textDocument/hover - (5)' in 1ms.
Result: null


[Trace - 10:47:18 AM] Sending request 'textDocument/documentHighlight - (6)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/laurynas/tmp/test.sh"
  },
  "position": {
    "line": 2,
    "character": 0
  }
}


[Trace - 10:47:18 AM] Sending notification '$/cancelRequest'.
Params: {
  "id": 6
}


[Trace - 10:47:18 AM] Sending request 'textDocument/documentHighlight - (7)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/laurynas/tmp/test.sh"
  },
  "position": {
    "line": 2,
    "character": 0
  }
}


[Trace - 10:47:18 AM] Received notification 'window/logMessage'.
Params: {
  "message": "onDocumentHighlight 2:0 ",
  "type": 4
}


[Trace - 10:47:18 AM] Received response 'nil - (6)' in 0ms.
Result: [
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  }
]


[Trace - 10:47:18 AM] Received notification 'window/logMessage'.
Params: {
  "message": "onDocumentHighlight 2:0 ",
  "type": 4
}


[Trace - 10:47:18 AM] Received response 'textDocument/documentHighlight - (7)' in 2ms.
Result: [
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  }
]


[Trace - 10:47:19 AM] Sending request 'textDocument/hover - (8)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/laurynas/tmp/test.sh"
  },
  "position": {
    "line": 0,
    "character": 0
  }
}


[Trace - 10:47:19 AM] Sending request 'textDocument/documentHighlight - (9)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/laurynas/tmp/test.sh"
  },
  "position": {
    "line": 0,
    "character": 0
  }
}


[Trace - 10:47:19 AM] Sending notification '$/cancelRequest'.
Params: {
  "id": 9
}


[Trace - 10:47:19 AM] Sending request 'textDocument/documentHighlight - (10)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/laurynas/tmp/test.sh"
  },
  "position": {
    "line": 0,
    "character": 0
  }
}


[Trace - 10:47:19 AM] Sending notification '$/cancelRequest'.
Params: {
  "id": 10
}


[Trace - 10:47:19 AM] Sending request 'textDocument/documentHighlight - (11)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/laurynas/tmp/test.sh"
  },
  "position": {
    "line": 0,
    "character": 0
  }
}


[Trace - 10:47:19 AM] Received notification 'window/logMessage'.
Params: {
  "message": "onHover 0:0 ",
  "type": 4
}


[Trace - 10:47:19 AM] Received response 'textDocument/hover - (8)' in 3ms.
Result: null


[Trace - 10:47:19 AM] Received notification 'window/logMessage'.
Params: {
  "message": "onDocumentHighlight 0:0 ",
  "type": 4
}


[Trace - 10:47:19 AM] Received response 'nil - (9)' in 0ms.
Result: [
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  }
]


[Trace - 10:47:19 AM] Received notification 'window/logMessage'.
Params: {
  "message": "onDocumentHighlight 0:0 ",
  "type": 4
}


[Trace - 10:47:19 AM] Received response 'nil - (10)' in 0ms.
Result: [
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  }
]


[Trace - 10:47:19 AM] Received notification 'window/logMessage'.
Params: {
  "message": "onDocumentHighlight 0:0 ",
  "type": 4
}


[Trace - 10:47:19 AM] Received response 'textDocument/documentHighlight - (11)' in 3ms.
Result: [
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  }
]


[Trace - 10:47:19 AM] Sending request 'textDocument/hover - (12)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/laurynas/tmp/test.sh"
  },
  "position": {
    "line": 0,
    "character": 0
  }
}


[Trace - 10:47:19 AM] Received notification 'window/logMessage'.
Params: {
  "message": "onHover 0:0 ",
  "type": 4
}


[Trace - 10:47:19 AM] Received response 'textDocument/hover - (12)' in 2ms.
Result: null


[Trace - 10:47:21 AM] Sending request 'textDocument/hover - (13)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/laurynas/tmp/test.sh"
  },
  "position": {
    "line": 0,
    "character": 0
  }
}


[Trace - 10:47:21 AM] Sending request 'textDocument/documentHighlight - (14)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/laurynas/tmp/test.sh"
  },
  "position": {
    "line": 0,
    "character": 0
  }
}


[Trace - 10:47:21 AM] Received notification 'window/logMessage'.
Params: {
  "message": "onHover 0:0 ",
  "type": 4
}


[Trace - 10:47:21 AM] Received response 'textDocument/hover - (13)' in 1ms.
Result: null


[Trace - 10:47:21 AM] Received notification 'window/logMessage'.
Params: {
  "message": "onDocumentHighlight 0:0 ",
  "type": 4
}


[Trace - 10:47:21 AM] Received response 'textDocument/documentHighlight - (14)' in 1ms.
Result: [
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  },
  {
    "range": null
  }
]


[Trace - 10:47:52 AM] Sending notification 'textDocument/willSave'.
Params: {
  "textDocument": {
    "uri": "file:///Users/laurynas/tmp/test.sh"
  },
  "reason": 2
}

Downstream report at emacs-lsp/lsp-mode#1541

@skovhus
Copy link
Collaborator

skovhus commented Apr 14, 2020

@laurynas-biveinis

Thanks for reporting this. I released a fix in version 1.11.2. Can you give that a spin? And please reopen if it fails for you.

@laurynas-biveinis
Copy link
Author

Confirmed fixed, thank you!

@truesilver92
Copy link

Looks good

domnewkirk added a commit to domnewkirk/bash-language-server that referenced this issue Jul 20, 2024
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

Successfully merging a pull request may close this issue.

3 participants