Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading from 2.1.1 to 2.2.0 has diagnostic for file with only comments #31

Closed
dsherret opened this issue Jan 18, 2020 · 3 comments
Closed
Assignees

Comments

@dsherret
Copy link

dsherret commented Jan 18, 2020

The following jsonc file returns a diagnostic in 2.2.0:

/// test
//////asdf

Diagnostic:

ValueExpected:  (20)

I know this is a rare scenario, but I believe this is a valid jsonc file and a diagnostic should not be created.

Additionally, in this scenario the return value of parser.parseTree is undefined yet the return value is not defined as possibly returning that value.

@dsherret dsherret changed the title Upgrading from 2.1.1 to 2.2.0 no longer allows parsing file with only comments Upgrading from 2.1.1 to 2.2.0 has diagnostic for file with only comments Jan 19, 2020
@aeschli
Copy link
Contributor

aeschli commented Jan 21, 2020

Use ParseOption.allowEmptyContent to allow such inputs again.

@aeschli aeschli closed this as completed Jan 21, 2020
@dsherret
Copy link
Author

dsherret commented Jan 21, 2020

@aeschli thanks! I'll update my code to use that. By the way, I think the changelog should be corrected for 2.2—it says allowTrailingComma was added instead of allowEmptyContent. Also, this is a breaking change so it probably should have been a major version increase, but that's not a big deal as this is a pretty rare scenario.

As always, thanks for the library!

@aeschli
Copy link
Contributor

aeschli commented Jan 22, 2020

You are right, should have been a major version change.
Updated the CHANGELOG.

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

No branches or pull requests

2 participants