emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Initial fontification in sh-mode with tree-sittter


From: João Paulo Labegalini de Carvalho
Subject: Re: Initial fontification in sh-mode with tree-sittter
Date: Fri, 28 Oct 2022 09:27:47 -0600

Hi,

In face of the comments about the risks of adding new faces, I edited my patch to only use existing faces from font-lock.

Please let me know what you think of this new patch.

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

Attachment: 0001-Initial-fontification-in-sh-mode-with-tree-sitter.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]