tweag / topiary

https://topiary.tweag.io/
MIT License
575 stars 29 forks source link

[Nickel] Add support for extended patterns #705

Closed yannham closed 5 months ago

yannham commented 5 months ago

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:

ErinvanderVeen commented 5 months ago

@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 commented 5 months ago

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

yannham commented 5 months ago

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

ErinvanderVeen commented 5 months ago

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

Sorry :worried:

yannham commented 5 months ago

Sorry 😟

No worries, it's my PR after all :slightly_smiling_face:

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

Xophmeister commented 5 months ago

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 :+1: