kdl-org / kdl

the kdl document language specifications
https://kdl.dev
Other
1.14k stars 63 forks source link

Proposal - allow forgoing semicolon when closing curly braces are on the same line #403

Closed imsnif closed 4 weeks ago

imsnif commented 4 weeks ago

Hey - my apologies if this has been discussed before, I could not find it when searching the issues - but it could also be that I lack the correct terminology.

In the Zellij configuration, we have lots of examples like these:

bind "Ctrl j" { NewPane; }
bind "Ctrl g" { SwitchToMode "normal"; }

A point of confusing that happens often is forgetting the semicolon to close the node right before the curly braces and thus encountering a parsing error when doing this:

bind "Ctrl j" { NewPane }
bind "Ctrl g" { SwitchToMode "normal" }

I feel that since the closing braces are on the same line, maybe it should be possible to make the semicolons optional in this case? Not sure if there are other considerations here that make this problematic (or if v2 solves this in some different way?) but thought I'd put this out there.

zkat commented 4 weeks ago

This change is already a part of kdl v2! So closing as resolved :) You only need ; to delimit between nodes on the same line now. See https://github.com/kdl-org/kdl/pull/286/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR46-R48

imsnif commented 4 weeks ago

Jubilation!