microsoft / microsoft/vscode-json-languageservice
[Bug report] Cannot format large json document
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 326
- Forks
- 145
- Avg merge
- 22h 10m
- Merged PRs (30d)
- 9
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing formatting with the attached tmp.json using the reported VS Code and macOS versions. Trace the formatting path corresponding to applyEdits in the JSON language service, then add or update coverage for the large document case. Done means formatting no longer crashes and the expected edits are applied successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100