Here is another version of the path. This has the queries separated into language related terms and groups them into lists of features.

Looking forward to your feedback.

Thanks.

On Thu, Oct 27, 2022 at 4:01 PM João Paulo Labegalini de Carvalho <jaopaulolc@gmail.com> wrote:
Hi everyone,

Please find the patch for enabling fontification in sh-mode (currently only for bash) using tree-sitter.

I welcome all comments and suggestions to improve the patch.

I noticed a weird behavior with heredocs. Take the code below:

echo <<EOF
This is a here document.
EOF
echo "Done."

My patch correctly fontifies the code above, but if I kill the whole line with the "This is a here document." text, then the sh-heredoc face bleeds out and all the subsequent comments get fontified as part of the heredoc.

A similar behavior happens if tree-sitter is not enabled, if the heredoc is empty then all subsequent commands are fontified as heredoc. However, as soon as anything is added to the heredoc, then everything goes back to the correct fontification. 

Such "refreshing" does not happen with tree-sitter enabled, but if I execute M-x sh-mode then the buffer gets refreshed and everything looks good.

What am I doing wrong?

--
João Paulo L. de Carvalho
Ph.D Computer Science |  IC-UNICAMP | Campinas , SP - Brazil
Postdoctoral Research Fellow | University of Alberta | Edmonton, AB - Canada


--
João Paulo L. de Carvalho
Ph.D Computer Science |  IC-UNICAMP | Campinas , SP - Brazil
Postdoctoral Research Fellow | University of Alberta | Edmonton, AB - Canada
joao.carvalho@ic.unicamp.br
joao.carvalho@ualberta.ca