From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "João Paulo Labegalini de Carvalho" <jaopaulolc@gmail.com>,
emacs-devel@gnu.org
Subject: Re: Initial fontification in sh-mode with tree-sittter
Date: Sat, 12 Nov 2022 11:45:53 -0800 [thread overview]
Message-ID: <F42F9BA5-BDC0-429E-9477-A2A2F26738A2@gmail.com> (raw)
In-Reply-To: <83y1sgmjax.fsf@gnu.org>
> On Nov 12, 2022, at 4:47 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: João Paulo Labegalini de Carvalho <jaopaulolc@gmail.com>
>> Date: Wed, 2 Nov 2022 12:55:31 -0600
>>
>> I missed the update that adds override as the last argument of the capture function. Fixed now.
>>
>> On Wed, Nov 2, 2022 at 12:22 PM João Paulo Labegalini de Carvalho <jaopaulolc@gmail.com> wrote:
>>
>> 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?
>
> Yuan, any comments? If you think this is OK for the tree-sitter
> branch, please install there.
I think there are still some details need to be addressed, eg,
> Also, when defining sh-mode--treesit-settings, instead of using the value sh-shell as the language, it’s better to just use ‘bash. Here is what happened to me: my default value for sh-shell is fish, so sh-mode--treesit-settings was defined with language = fish. When I open heredoc-issue.sh, sh-mode parses the shebang and sets sh-shell to bash. Since bash does have a parser, (treesit-ready-p ’sh-mode sh-shell) returns t, and tree-sitter is activated. However when font-lock tries to use the query, it errors because query tries to load a parser for fish.
(I can make the change myself though)
Yuan
next prev parent reply other threads:[~2022-11-12 19:45 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 22:01 Initial fontification in sh-mode with tree-sittter João Paulo Labegalini de Carvalho
2022-10-27 23:09 ` João Paulo Labegalini de Carvalho
2022-10-27 23:40 ` João Paulo Labegalini de Carvalho
2022-10-28 8:12 ` Yuan Fu
2022-10-28 15:09 ` Daniel Martín
2022-10-31 2:13 ` Yuan Fu
2022-10-31 21:56 ` Yuan Fu
2022-11-01 0:09 ` Daniel Martín
2022-11-01 0:25 ` Yuan Fu
2022-11-01 7:13 ` Eli Zaretskii
2022-11-01 8:35 ` Yuan Fu
2022-11-01 9:23 ` Eli Zaretskii
[not found] ` <CAGjvy2_6BReOVjSqgTM57+h+Ycjdu1o1TKoQHf6q-ypnAX3=rA@mail.gmail.com>
2022-11-02 19:17 ` Eli Zaretskii
2022-11-03 1:25 ` Yuan Fu
2022-11-03 6:36 ` Eli Zaretskii
2022-11-03 7:16 ` Yuan Fu
2022-11-03 16:08 ` João Paulo Labegalini de Carvalho
2022-11-03 19:12 ` Yuan Fu
2022-11-04 20:44 ` João Paulo Labegalini de Carvalho
2022-11-04 22:50 ` Yuan Fu
2022-11-12 22:04 ` João Paulo Labegalini de Carvalho
2022-11-12 22:28 ` Yuan Fu
2022-11-12 23:57 ` João Paulo Labegalini de Carvalho
2022-11-16 8:34 ` Yuan Fu
2022-11-16 15:57 ` João Paulo Labegalini de Carvalho
2022-11-17 18:25 ` Yuan Fu
2022-11-17 18:53 ` João Paulo Labegalini de Carvalho
2022-11-17 19:11 ` Yuan Fu
2022-11-13 6:23 ` Eli Zaretskii
2022-11-13 7:01 ` Yuan Fu
2022-11-13 7:26 ` Eli Zaretskii
2022-11-29 21:52 ` João Paulo Labegalini de Carvalho
2022-11-02 20:37 ` [SPAM UNSURE] " Stephen Leake
2022-10-28 0:18 ` Stefan Kangas
2022-10-28 0:48 ` João Paulo Labegalini de Carvalho
2022-10-28 15:27 ` João Paulo Labegalini de Carvalho
2022-10-28 15:57 ` Stefan Kangas
2022-10-28 16:15 ` Stefan Monnier
2022-10-28 16:23 ` Theodor Thornhill
2022-10-28 16:34 ` João Paulo Labegalini de Carvalho
2022-10-28 17:37 ` Stefan Monnier
2022-10-28 17:45 ` Yuan Fu
2022-10-28 18:12 ` Stefan Monnier
2022-11-01 0:33 ` Yuan Fu
2022-11-01 3:38 ` Stefan Monnier
2022-11-01 8:37 ` Yuan Fu
2022-10-29 7:13 ` Augusto Stoffel
2022-10-28 17:44 ` Yuan Fu
2022-11-02 18:22 ` João Paulo Labegalini de Carvalho
2022-11-02 18:55 ` João Paulo Labegalini de Carvalho
2022-11-12 12:47 ` Eli Zaretskii
2022-11-12 19:45 ` Yuan Fu [this message]
2022-11-12 19:53 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=F42F9BA5-BDC0-429E-9477-A2A2F26738A2@gmail.com \
--to=casouri@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=jaopaulolc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.