Repository navigation
adding zsh expansion flags - #115
Conversation
|
I've been using this for a month now and it makes most stuff in zsh pretty usable. |
|
Hi there. Not certain on etiquette here. Wondering if someone can have a gander at this? |
|
It would be awesome if zsh was supported 👏 |
|
This makes sense. Thanks! |
|
@maxbrunsfeld thanks. Will you cut a new release? |
|
I don't like this. I want to parse bash, not zsh. You should fork this into a separate |
|
I agree with @verhovsky, while this is a good first start, there's a lot more that would be needed to actually support Zsh properly, and that would make sense in a fork. For Zsh expansion flags alone, this PR incorrectly parses |
|
I reverted this change for the reason I mentioned above. We could even create a separate tree-sitter-shell repository that parses (tries to parse) all shells. |
|
@ryaminal any interest in getting the fork going? |
|
Bleh, when this was reverted last year, unilaterally, after it was in the code for almost a year, I was pretty frustrated. Still frustrated. That being said, I avoided a fork because the overhead there for a few small changes seemed not worth it. It's 90% the same, so why not add a few pieces. We can surely create a generic |
I'm not so sure. Bash and Zsh differ syntactically. Attempting to support both at once will cause bugs, like these from Zsh's relaxed brace rules:
|
|
f(){
x=y
echo $#x
}
f # prints "1"
emulate ksh # shortcut for an option set which, among others, includes "ksh_arrays" and "posix_identifiers"
f # prints "0x"
This is uncommon though. In any case, if someone wants to use Ksh emulation, they should probably use a Ksh or Bash parser anyway. |
See https://zsh.sourceforge.io/Doc/Release/Expansion.html#Parameter-Expansion-Flags for more information on this
Hi all,
I'm wanting to add this feature that I understand is ZSH specific. I understand that this may not be desirable to have in the bash tree-sitter, but I figured I'd start the conversation with these changes and see what people's thoughts are.
I've added
zshto the package.json'sfile-typessection. This can, likely, be removed and a user can add aused_bysection to the config.I've tested this with nvim and
tree-sitter highlight(along with test, of course).