Home > Enterprise >  VSCode Unable to load and parse grammar for scope source.ts
VSCode Unable to load and parse grammar for scope source.ts

Time:11-18

VSCode Developer Tools:

  ERR Unable to load and parse grammar for scope source.ts from file:///Users/xxxxxxx/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.20221116/syntaxes/TypeScript.tmLanguage.json SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at t.parseRawGrammar (grammarReader.js:22:17)
    at Object.loadGrammar (TMGrammarFactory.ts:55:28)
  INFO [perf] Render performance baseline is 31ms
  ERR read ECONNRESET: Error: read ECONNRESET
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)

Version: 1.73.1
Commit: 6261075646f055b99068d3688932416f2346dd3b
Date: 2022-11-09T02:08:38.961Z
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin x64 21.6.0
Sandboxed: No

CodePudding user response:

When I opened VSCode this morning, my themes were being applied to everything except for the code, the text was all white. I tried re-installing/changing themes and re-installing/updating VSCode but still nothing. I looked at the error in the console and got the same error as above.

Opened the file(TypeScript.tmLanguage.json) and it was empty. Noticed the warnings:

  • Overwriting grammar scope name to file mapping for scope source.ts.

  • Old grammar file: ...

  • New grammar file: ...

So I copied the content from Old grammar file to the New grammar file and my themes were working properly again with highlighted syntax.

CodePudding user response:

I just wanted to add what I did to fix this. Using the other answer, I was able to get more information and find a solution. The problem for me was I had the "JavaScript and TypeScript Nightly" extension installed. Simply uninstalling the nightly extension fixed this issue for me. I think I installed this thinking I needed the extension at some point, but everything works fine without it. If you click the reviews on this extension, you'll see a bunch of other people with the same issue.

  • Related