GNU bug report logs -
#64647
treesit-query-error due to a recent change to tree-sitter-javascript grammar definition
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hi,
In data domenica 16 luglio 2023 20:19:38 CEST, Eli Zaretskii ha scritto:
> > From: Vincenzo Pupillo <v.pupillo <at> gmail.com>
> > Cc: 64647 <at> debbugs.gnu.org, jostein <at> 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
[0001-Updated-JSX-support-due-to-changes-in-tree-sitter-ja.patch (text/x-patch, attachment)]
[0002-Updated-JSX-support-due-to-changes-in-tree-sitter-ty.patch (text/x-patch, attachment)]
This bug report was last modified 2 years and 17 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.