Skip to content

Conversation

@Bahex
Copy link
Contributor

@Bahex Bahex commented Oct 13, 2025

I'm hoping most of these are uncontroversial.

Each commit has one change and includes tests, reviewing them individually should be pretty smooth.

Copy link
Owner

@blindFS blindFS left a comment

Choose a reason for hiding this comment

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

Thanks for contributing!
Most of the changes look good to me.

Just one design choice to be discussed: I'd like to force comma delimiters for both multiline and singleline cases.

}
match $foo {
[ a b c] => 0
a|b|c => 42
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe test for a multiline pattern? But I don't even know if that's valid...

@Bahex
Copy link
Contributor Author

Bahex commented Oct 13, 2025

I'd like to force comma delimiters for both multiline and singleline cases.

I actually prefer that too, just wasn't sure if everyone prefers that.

@blindFS
Copy link
Owner

blindFS commented Oct 13, 2025

I'd like to force comma delimiters for both multiline and singleline cases.

I actually prefer that too, just wasn't sure if everyone prefers that.

Let's ask for some other users' preferences @fdncred @maxim-uvarov @mkatychev

@fdncred
Copy link

fdncred commented Oct 13, 2025

I never use commas, why type them when you don't have to?

@mkatychev
Copy link
Contributor

I never use commas, why type them when you don't have to?

I agree and was on your side initially but for some things like parameters and lists
I use them because arbitrary delimiters makes search and replace much easier. This was one of the queries I had meant to contribute actually because doing a %s/,/,\n (for example) is much easier than working with capture groups.

Repository owner deleted a comment from Bahex Oct 13, 2025
Comment on lines 310 to 322
(val_list
entry: _ @append_space
entry: (_) @append_delimiter
;; unlike list expressions, list patterns include commas as anonymous nodes.
;; this is required to avoid adding multiple commas
","* @do_nothing
entry: (_)
(#delimiter! ",")
)
(val_list
.
entry: _ @prepend_spaced_softline
entry: (_)
entry: (_) @prepend_spaced_softline
)
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
(val_list
entry: _ @append_space
entry: (_) @append_delimiter
;; unlike list expressions, list patterns include commas as anonymous nodes.
;; this is required to avoid adding multiple commas
","* @do_nothing
entry: (_)
(#delimiter! ",")
)
(val_list
.
entry: _ @prepend_spaced_softline
entry: (_)
entry: (_) @prepend_spaced_softline
)
(val_list
entry: (_) @append_delimiter
;; unlike list expressions, list patterns include commas as anonymous nodes.
;; this is required to avoid adding multiple commas
","* @do_nothing
.
entry: (_)
(#delimiter! ",")
)
(val_list
entry: (_) @append_begin_scope
.
entry: (_) @prepend_spaced_softline
(#scope_id! "consecutive_scope")
)

Copy link
Owner

Choose a reason for hiding this comment

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

I almost forgot, there's a hidden ts issue here:

;; TODO: pseudo scope_id to cope with
;; https://github.com/tree-sitter/tree-sitter/discussions/3967

Copy link
Owner

Choose a reason for hiding this comment

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

@Bahex Here's a hack to workaround the case in your previous comment, sorry I accidentally deleted it.

And the GitHub webpage is not clever enough to let me commit it. Maybe you'll have to manually do it (same for the val_record) later when we come to a conclusion of the desired behavior.

Copy link
Contributor

@mkatychev mkatychev Oct 13, 2025

Choose a reason for hiding this comment

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

@blindFS you can always suggest a git patch:

```patch
# paste git diff output here
```

tweag/topiary#921 (comment)

@maxim-uvarov
Copy link
Contributor

I don't really have any preference here. The only thing that comes to my mind is that commas are better for learners, as they might point out missed mistakes. But that's a very subtle feeling.

@blindFS
Copy link
Owner

blindFS commented Oct 14, 2025

I never use commas, why type them when you don't have to?

Will you accept it if the formatter does the typing for you?

I'm fine with both styles, commas slightly improve readability IMHO.

@blindFS
Copy link
Owner

blindFS commented Oct 14, 2025

@Bahex I've cherry-picked the delimiter unrelated fixes into another PR #31.

I'll handle the delimiter changes manually later when we come to an agreement.

I'm closing this because a mixture of both styles seems preferred by none of us.
Thanks for the style suggestion and fixes!

@fdncred
Copy link

fdncred commented Oct 14, 2025

Will you accept it if the formatter does the typing for you?

probably so. however, i think nushell should've taken the stance that it didn't allow commas instead of allowing it both ways.

@blindFS
Copy link
Owner

blindFS commented Oct 14, 2025

Will you accept it if the formatter does the typing for you?

probably so. however, i think nushell should've taken the stance that it didn't allow commas instead of allowing it both ways.

I see, do you think this topic worth discussing among you core members? I've created a poll in #32 anyway.

@fdncred
Copy link

fdncred commented Oct 14, 2025

people generally gather to the comma way of doing things, and that's fine. commas have been ubiquitous in programming languages for decades. so, it's really about what they're used to working with or seeing so therefore it's easier for them to understand. i don't really have a problem with commas either, but my preference is usually just less typing for things like this, but more typing for other things like more verbose command and operator naming lol. to each his own.

imo, the mistake was to give people a choice. this causes confusion and causes division in the community, which is unnecessary. i could live with either option.

@blindFS
Copy link
Owner

blindFS commented Oct 14, 2025

imo, the mistake was to give people a choice. this causes confusion and causes division in the community, which is unnecessary.

I agree.

@maxim-uvarov
Copy link
Contributor

imo, the mistake was to give people a choice. this causes confusion and causes division in the community, which is unnecessary. i could live with either option.

+1

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.

5 participants