question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: Allow `tsconfig.json` to have trailing commas

See original GitHub issue

WWD cannot start a debug session for a *.ts file unless its corresponding tsconfig.json is free of trailing commas & comments (i.e. it must be “true” JSON). In contrast, tsc and the TypeScript language server (or at least recent versions of them) have no trouble with dealing with that. It must be they allow the tsconfig.json to use the syntax of a *.jsonc / “JSON with comments” file.

This means it may be possible to build & run a TypeScript project in a terminal, but not debug it in WWD (unless attaching to a running instance), because WWD’s requirements on what constitutes a valid tsconfig.json are stricter than tsc’s.

To save the effort of having to edit a tsconfig.json just to make it compatible with WWD, it would be nice if WWD could be more lax in its parsing of the tsconfig.json file, to parse only the bare minimum of what it needs to start a debug session.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
AndrewFerrcommented, Nov 29, 2022

Actually, a simple fix would be to just strip out end-of-line commas in the file before passing it to GSON.

It may still be a good idea to migrate from GSON since it’s in maintenance mode (though I can’t imagine how much continuous development a JSON parser would need), but for now handling this parsing issue locally should be sufficient.

I intend to provide a contribution for this.

1reaction
mickaelistriacommented, Nov 21, 2022

I think the entry point where to read the tsconfig.json file with higher tolerance is NodeRunDAPDebugDelegate.readJSonFile . Would you be interested in trying to contribute a fix?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trailing commas - JavaScript - MDN Web Docs
Trailing commas (sometimes called "final commas") can be useful when adding new elements, parameters, or properties to JavaScript code.
Read more >
How to Allow Trailing Commas (Comma-Dangle) With ...
ESLint comes with support to require or disallow trailing commas. This option is also known as “comma-dangle”. Trailing commas are supported ...
Read more >
Can you use a trailing comma in a JSON object?
No. The JSON spec, as maintained at http://json.org, does not allow trailing commas. From ...
Read more >
The starting point for learning TypeScript
Find TypeScript starter projects: from Angular to React or Node.js and CLIs.
Read more >
Content Types - ESBuild
Trailing commas in function parameter lists and calls, es2017, foo(a, b, ) ... However, it means that some TypeScript compilation features which require...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found