Skip to content

[Bug report] Cannot format large json document #262

Open
@XixianLiang

Description

@XixianLiang

Explanation

The json-language-server crash when I try to parse a large json file. But it works when I try to parse a smaller one.

Here's the file that I failed to parse.
tmp.json

Here is the stack trace.

Error - 16:52:14] Error while formatting range for file:///<...>/tmp.json: Cannot read properties of undefined (reading 'length')
TypeError: Cannot read properties of undefined (reading 'length')
    at e.applyEdits (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/json-language-features/server/dist/node/875.jsonServerMain.js:1:55701)
    at F (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/json-language-features/server/dist/node/774.jsonServerMain.js:1:5466)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/json-language-features/server/dist/node/774.jsonServerMain.js:1:6731
    at Immediate._onImmediate (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/json-language-features/server/dist/node/774.jsonServerMain.js:1:12112)
    at process.processImmediate (node:internal/timers:483:21)

Version

Version: 1.99.3 (Universal)
Commit: 17baf841131aa23349f217ca7c570c76ee87b957
Date: 2025-04-15T23:18:46.076Z (1 day ago)
Electron: 34.3.2
ElectronBuildId: 11161073
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.4.0
OS:
macOS sequoia 15.4
apple m2

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