Subject: bug#59445: 29.0.50; Tweak tree sitter faces in Java and TypeScript

From: Randy Taylor <[email-masked]>
Date: Tue, 22 Nov 2022 22:31:47 +0000

On Tuesday, November 22nd, 2022 at 05:08, Yuan Fu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email-masked]> wrote:
> 
> Randy Taylor [email-masked] writes:
> 
> > On Monday, November 21st, 2022 at 07:13, Theodor Thornhill via "Bug
> > reports for GNU Emacs, the Swiss army knife of text editors"
> > [email-masked] wrote:
> > 
> > > Hi Yuan!
> > > 
> > > I tweaked Java and TypeScript a little.
> > > 
> > > Feel free to apply when you have the time :)
> > > 
> > > Theo
> 
> 
> Thanks, I just applied this patch.
> 
> > Looks good.
> > 
> > For java-ts-mode.el can you show examples of what bracket and
> > delimiter highlight with your changes? I couldn't get them to
> > highlight anything when I tested and I had the exact same queries as
> > you, hence why I left them out of my patch. Similar thing occurred
> > with sh-script.el.
> 
> 
> Have you tried using treesit-query-capture to "manually" capture these
> nodes? I always use
> 
> (treesit-query-capture (treesit-buffer-root-node) <query> (region-beginning) (region-end))
> 
> 
> Yuan
> 

No, I've never tried that before. But I found out what the problem was:

   '(["(" ")" "[" "]" "{" "}"] @font-lock-bracket-face)

The above query works fine for javascript and typescript, but not for java. Java needs it to be (note the parens surrounding the brackets):

   '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)