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

removing strip-comments and using prettier to clean pragma versions #1063

Closed
wants to merge 3 commits into from

Conversation

Janther
Copy link
Contributor

@Janther Janther commented Nov 3, 2024

Aware this might be an overkill but the possible issue is really difficult to solve with other means (see tests).

I have a different approach to get rid of the strip-comments dependencies if this gets rejected.

@Janther Janther requested a review from fvictorio November 3, 2024 09:26
parser: 'slangPragma'
};

const query = Query.parse(
Copy link
Member

Choose a reason for hiding this comment

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

I noticed you moved query out of the tryToCollectPragmas function, but you only use it there; should we move it back to its original location?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this way the query is computed only once and not every time it tryToCollectPragmas is called

tests/unit/slang-utils/create-parser.test.js Outdated Show resolved Hide resolved
Copy link
Member

@mattiaerre mattiaerre left a comment

Choose a reason for hiding this comment

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

🚀

@Janther Janther force-pushed the prettier-for-pragma-version branch from f2b6050 to a167be2 Compare November 13, 2024 04:42
@fvictorio
Copy link
Member

I think I'd rather not support very weird pragma versions, like the one in the new test, and rather check that we throw a decent error when that happens (throw "couldn't parse version pragma in file " and crash).

@Janther
Copy link
Contributor Author

Janther commented Nov 15, 2024

I made a new PR I had prepared if this one was too ambitious and complicated maintenance

@Janther Janther closed this Nov 15, 2024
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.

3 participants