Skip to content

Conversation

@AndrewFerr
Copy link
Member

Fixes #971


Note that I did look into replacing Gson with another parser (I gave Jackson a try), but it turns out that Gson is used not only in WWD, but across the LSP4E and TM4E projects, which all pass Gson objects between each other. Replacing Gson would thus take a bit of coordination across all three projects.

Plus, the libraries of whatever new parser is used would have to be provided in WWD's Eclipse repository, as Gson currently is.

So for now, just doing some manual parsing should be the least disruptive solution for the filed issue.

Also note that the comment-stripping isn't strictly necessary (as Gson's default configuration accepts comments), but it helps with handling comments that follow a trailing comma.

Comment on lines 323 to 326
var responseString = response.toString();
responseString = BlockCommentPattern.matcher(responseString).replaceAll("");
responseString = LineCommentPattern.matcher(responseString).replaceAll("");
responseString = TrailingCommaPattern.matcher(responseString).replaceAll("$1}");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please extract it into a dedicated method with a nice name and some documentation to not forget what case they're serving?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done by acdd258. The docstring doesn't make explicit mention of what kind of preprocessing is done, so that if any other JSON tweaks are needed, the documentation & method name may remain unchanged & continue to be accurate.

@mickaelistria
Copy link
Contributor

Thanks. It looks like there is some ECA check issue. Can you please verify you used on both commits the author email that matches the one you signed ECA with?

@AndrewFerr AndrewFerr force-pushed the tsconfig-trailing-commas branch from acdd258 to 889b5dc Compare December 10, 2022 05:18
@AndrewFerr
Copy link
Member Author

I've amended the commits' author/committer email address to the one I signed the ECA with.

@mickaelistria mickaelistria force-pushed the tsconfig-trailing-commas branch from 889b5dc to 844bb54 Compare December 10, 2022 21:08
@mickaelistria
Copy link
Contributor

The failure is definitely not related. let's merge. Thanks!

@mickaelistria mickaelistria merged commit 3d548a9 into eclipse-wildwebdeveloper:master Dec 11, 2022
@AndrewFerr AndrewFerr deleted the tsconfig-trailing-commas branch February 28, 2023 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Allow tsconfig.json to have trailing commas

2 participants