tree-sitter has a grammar only for bash, but sh-mode has multiple "submodes"
Opened this issue · 1 comments
I notice that tree-sitter does not correctly highlight all the builtins from other shells, namely zsh in my case. After some investigation I found that it uses the tree-sitter-bash parser, which at a glance seems to only have a grammar for bash. In Emacs, sh-mode can do multiple shells, sh, bash, zsh, etc.
I know the real solution is upstream (e.g. a tree-sitter-zsh
, probably derived from bash, as there are very many syntax similarities), but in the meantime, is there something this package can do? The solution I think about is disabling tree-sitter-hl-mode
from the emacs config when dealing with shells that are not bash, but is there a possibility of solving it from a potential queries/bash/highlights.scm
?
You can try setting the buffer-local value of tree-sitter-hl-use-font-lock-keywords
to t
, in zsh buffers.