Why does VS Code often fail to parse package.json, and show syntax errors?

Viewed 1287

So I've been using VS Code for several years, and this problem has persisted among many, many versions of VS Code. I'd like to understand what's going on:

When I open and edit a package.json file in any project (and ONLY a package.json--at least, this is the only file type I've noticed it happening in), VS Code frequently fails to parse the file, citing a syntax error in a random place. Example:

enter image description here

The thing is, there is no syntax error. Here's another screenshot, without the error message:

enter image description here

Sometimes the "red squiggle" is at the beginning of the file, sometimes it's near the end. I can't seem to find a pattern there.

It looks to me like VS Code is getting a truncated version of the file, parsing it, and discovering incomplete or missing pieces.

Am I the only one having this issue? How do I discover what's going on and why?

Update: Here's another screenshot, as it's been happening again. I don't even understand what plugin is doing this--maybe it's a vscode built-in parser?

enter image description here

Version info: Version: 1.49.3 Commit: 2af051012b66169dde0c4dfae3f5ef48f787ff69 Date: 2020-10-02T17:54:06.165Z Electron: 9.2.1 Chrome: 83.0.4103.122 Node.js: 12.14.1 V8: 8.3.110.13-electron.0 OS: Darwin x64 18.7.0

0 Answers
Related