microsoft / microsoft/vscode-json-languageservice

Request textDocument/documentSymbol failed. - Cannot read properties of undefined (reading 'range')

Open
#182 0 comments 0 reactions 1 assignee View on GitHub

@aeschli is already working on this.

Since Mar 21, 2023.

bug
Dominant language
TypeScript
Stars
326
Forks
145
Avg merge
22h 10m
Merged PRs (30d)
9

Description

Getting Request textDocument/documentSymbol failed notification. I think the problem in that the textDocument/documentSymbol is returning "name": [] (see the trace below), while name should be a string (ref)

JSON doc contents (my keybindings.json):

[
	{
		"key": [],
		"command": "runCommands",
		"args": {}
	},
]

Exception trace

[Error - 14:48:33] Request textDocument/documentSymbol failed.
TypeError: Cannot read properties of undefined (reading 'range')
    at W (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/json-language-features/client/dist/node/jsonClientMain.js:2:886962)
    at c (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/json-language-features/client/dist/node/jsonClientMain.js:2:925248)
    at Object.t.map (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/json-language-features/client/dist/node/jsonClientMain.js:2:925334)
    at Object.asSymbolInformations (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/json-language-features/client/dist/node/jsonClientMain.js:2:894974)
    at i (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/json-language-features/client/dist/node/jsonClientMain.js:2:833738)
    at t.provideDocumentSymbols (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:100:38974)

Log Trace

[Trace - 14:48:33] Sending request 'textDocument/documentSymbol - (148)'.
Params: {
    "textDocument": {
        "uri": "vscode-userdata:/Users/ulugbekna/Library/Application%20Support/Code%20-%20Insiders/User/keybindings.json"
    }
}


[Trace - 14:48:33] Received response 'textDocument/documentSymbol - (148)' in 1ms.
Result: [
    {
        "name": [],
        "kind": 12,
        "range": {
            "start": {
                "line": 1,
                "character": 1
            },
            "end": {
                "line": 3,
                "character": 2
            }
        },
        "selectionRange": {
            "start": {
                "line": 2,
                "character": 2
            },
            "end": {
                "line": 2,
                "character": 7
            }
        }
    }
]

Version info

Version: 1.77.0-insider (Universal)
Commit: 833ac685084e2028b09753392b82c641c7025bbc
Date: 2023-03-21T05:26:40.905Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Darwin arm64 22.3.0
Sandboxed: Yes

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.