Skip to content

Conversation

@yannham
Copy link
Contributor

@yannham yannham commented May 28, 2024

Extended patterns

This PR adds support for the last train of new pattern features in current Nickel: wildcard patterns, or-patterns, array patterns, constant patterns and pattern guards.

Description

Update to latest Nickel tree-sitter grammar and add queries to format the new constructs.

Checklist

Checklist before merging:

  • CHANGELOG.md updated
  • README.md up-to-date

@yannham yannham force-pushed the nickel/extended-patterns-format branch 2 times, most recently from 654f754 to 3548bbb Compare May 29, 2024 16:21
@yannham yannham marked this pull request as ready for review May 29, 2024 16:21
Copy link
Member

@Xophmeister Xophmeister left a comment

Choose a reason for hiding this comment

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

The changes look good, but I would suggest:

@yannham Can some example code that hit your new formatting rules be added to topiary-cli/tests/samples/{input,expected}/nickel.ncl so they are tested?

@ErinvanderVeen I would cherry-pick your changes to bin/update-wasm-grammars.sh into a separate PR -- along with the updates to the non-Nickel WASM grammars -- so this PR can be more focused.

@ErinvanderVeen
Copy link
Collaborator

@yannham Can some example code that hit your new formatting rules be added to topiary-cli/tests/samples/{input,expected}/nickel.ncl so they are tested?

The new tests were blocked because there was an issue in the tree-sitter grammar. Yann has resolved this issue, but it still needs to merged.

@yannham
Copy link
Contributor Author

yannham commented May 31, 2024

If I understood correctly, @ErinvanderVeen is willing to take over and to take this PR to the finish line.

@yannham
Copy link
Contributor Author

yannham commented Jun 4, 2024

In fact I'm going to take over again, as this is blocking for the next Nickel release 🙂

@ErinvanderVeen
Copy link
Collaborator

In fact I'm going to take over again, as this is blocking for the next Nickel release 🙂

Sorry 😟

yannham added 2 commits June 5, 2024 10:59
This commit updates to the latest Nickel grammar, which includes pattern
matching extensions (guards, wildcards, constants, arrays, or-patterns)
and specifies their corresponding formatting rules.
@yannham yannham force-pushed the nickel/extended-patterns-format branch from 042ce20 to be73d73 Compare June 5, 2024 09:09
@yannham yannham requested a review from Xophmeister June 5, 2024 09:09
@yannham
Copy link
Contributor Author

yannham commented Jun 5, 2024

Sorry 😟

No worries, it's my PR after all 🙂

@Xophmeister I ditched the WASM changes and added a few patterns to test the formatting. Let me know what you think

@Xophmeister
Copy link
Member

Looks good... Let me just cherry-pick @ErinvanderVeen's commit into a separate branch before it gets lost. Also, I'll regenerate the Nickel WASM for this PR. Give me a sec, then I'll approve 👍

@yannham yannham merged commit 3da6fb5 into main Jun 5, 2024
@yannham yannham deleted the nickel/extended-patterns-format branch June 5, 2024 10:48
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.

4 participants