GNU bug report logs - #64647
treesit-query-error due to a recent change to tree-sitter-javascript grammar definition

Previous Next

Package: emacs;

Reported by: Vincenzo Pupillo <v.pupillo <at> gmail.com>

Date: Sat, 15 Jul 2023 12:35:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #68 received at 64647 <at> debbugs.gnu.org (full text, mbox):

From: Theodor Thornhill <theo <at> thornhill.no>
To: Vincenzo Pupillo <v.pupillo <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 64647 <at> debbugs.gnu.org, jostein <at> kjonigsen.net
Subject: Re: bug#64647: treesit-query-error due to a recent change to
 tree-sitter-javascript grammar definition
Date: Sat, 22 Jul 2023 13:56:04 +0200
Vincenzo Pupillo <v.pupillo <at> gmail.com> writes:

> In data mercoledì 19 luglio 2023 07:11:05 CEST, Theodor Thornhill ha scritto:
>
>> For Typescript these changes should go into 'tsx-ts-mode, not
>> 'typescript-ts-mode. That may be why you are seeing some strange results?
> No, exactly the same problem occurs, unfortunately. After all, the sources of 
> libtree-sitter-tsx and libtree-sitter-typescript come from the same repository 
> and the content of  tree-sitter-typescript/tsx/grammar.js is just that:
> const defineGrammar = require('../common/define-grammar');
> module.exports = defineGrammar('tsx');
>
>
>> > ---
>> 
>> "... function to handle ..."
>
> fixed

Thanks for the fixes :)

>
>
> Sorry for the error. I fixed them, tested and fixed the function names according to your instructions (also in js.el)
> Hope the patches are better now.
> Thanks.
> Vincenzo
>

No worries! Am I correct in that this patch should be applied as well?
If you agree, I'll just apply it myself, no need to make a new patch.


Theo

diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index 173ec52f209..39fcd1de30e 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -75,10 +75,10 @@ typescript-ts-mode--syntax-table
     table)
   "Syntax table for `typescript-ts-mode'.")
 
-(defun tsx-ts-mode--indent-compatibility-b893426 ()
+(defun tsx-ts-mode--indent-compatibility-bb1f97b ()
   "Indent rules helper, to handle different releases of tree-sitter-tsx.
 Check if a node type is available, then return the right indent rules."
-  ;; handle commit b893426
+  ;; handle commit bb1f97b
   (condition-case nil
       (progn (treesit-query-capture 'tsx '((jsx_fragment) @capture))
              `(((match "<" "jsx_fragment") parent 0)
@@ -122,7 +122,7 @@ typescript-ts-mode--indent-rules
      ((parent-is "binary_expression") parent-bol typescript-ts-mode-indent-offset)
 
      ,@(when (eq language 'tsx)
-	 (append (tsx-ts-mode--indent-compatibility-b893426)
+	 (append (tsx-ts-mode--indent-compatibility-bb1f97b)
 		 `(((node-is "jsx_closing_element") parent 0)
 		   ((match "jsx_element" "statement") parent typescript-ts-mode-indent-offset)
 		   ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset)




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.