bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#64647: treesit-query-error due to a recent change to tree-sitter-jav


From: Vincenzo Pupillo
Subject: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition
Date: Mon, 17 Jul 2023 23:24:20 +0200

Hi,

In data domenica 16 luglio 2023 20:19:38 CEST, Eli Zaretskii ha scritto:
> > From: Vincenzo Pupillo <v.pupillo@gmail.com>
> > Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net
> > Date: Sun, 16 Jul 2023 20:00:43 +0200
> > 
> > In my patch for java-ts-mode I used treesit-query-capture to figure out
> > whether a symbol was defined or not. Check out the
> > java-ts-mode--string-highlight- helper function.
> 
> Can you do something similar in this case?  That would be good enough
> for Emacs 29.1.

In attachment you can find the new version of the patches (similar to the patch 
that i made for java-ts-mode).
The patches were made on the branch emacs-29.  

Both work with the latest grammar. The javascript version is reliable, the 
typescrypt version seems reliable. In fact, drum roll, with typescrypt both 
tests:
1. (treesit-query-capture 'typescript '((member_expression) @capture)) ;; the 
new node type
2. (treesit-query-capture 'typescript '((nested_identifier) @capture)) ;; the 
old node type
both return nil !!!
If you use #2, then treesitter-ts-mode font lock gives an error!
This happens only for font-lock, while for indentation everything works 
correctly.

No problem for javascript, it works as expected for font-lock. The old node 
type returns an error with treesit-query-capture.

@Theo: I am not sure if the indentation works if I add the new rules to 
treesit-simple-indent-rules in the Init function. I am writing a major-mode 
for php and, unless I am mistaken or due to problems with the various 
treesitter parsers, the order seems to be important.

P.S. I opened two issues (one moth ago) for tree-sitter-php because it flags 
variables with names in non-Western characters as errors. tree-sitter-html, 
after they rewrote the parse from C++ to C, it crashed when used in 
conjunction with other parsers.

Sorry for the length of this email (and for my English)

Vincenzo


 

Attachment: 0001-Updated-JSX-support-due-to-changes-in-tree-sitter-ja.patch
Description: Text Data

Attachment: 0002-Updated-JSX-support-due-to-changes-in-tree-sitter-ty.patch
Description: Text Data


reply via email to

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