GNU bug report logs - #62086
29.0.60; ruby-ts-mode regressions

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Thu, 9 Mar 2023 17:28:02 UTC

Severity: normal

Fixed in version 29.0.60

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Yuan Fu <casouri <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 62086 <at> debbugs.gnu.org, Theodor Thornhill <theo <at> thornhill.no>, Juri Linkov <juri <at> linkov.net>
Subject: bug#62086: 29.0.60; ruby-ts-mode regressions
Date: Wed, 12 Apr 2023 00:05:41 -0700

> On Apr 11, 2023, at 4:30 PM, Dmitry Gutov <dgutov <at> yandex.ru> wrote:
> 
> On 11/04/2023 19:53, Juri Linkov wrote:
>> I don't know if opening a new bug report is needed.
>> Actually I'm doing the same thing for more ts-modes -
>> trying to find a set of node names that match parens/brackets.
>> So maybe this patch makes sense too:
> 
> These look sensible to me.
> 
> I think we should give a chance to the authors to chime in, though.
> 
>> treesit-sexp-type-regexp.patch
>> diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
>> index d773b4a41f4..e55d26177af 100644
>> --- a/lisp/progmodes/c-ts-mode.el
>> +++ b/lisp/progmodes/c-ts-mode.el
>> @@ -927,7 +927,9 @@ c-ts-base-mode
>>                              "qualifier"
>>                              "type"
>>                              "parameter"
>> -                            "expression"
>> +                            ;; "expression"
>> +                            "argument_list"
>> +                            "identifier"
>>                              "literal"
>>                              "string")))
>>  diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
>> index f68ecb6fa6c..3876a5b54f1 100644
>> --- a/lisp/progmodes/js.el
>> +++ b/lisp/progmodes/js.el
>> @@ -3827,7 +3827,9 @@ js--treesit-sentence-nodes
>>  "See `treesit-sentence-type-regexp' for more information.")
>>    (defvar js--treesit-sexp-nodes
>> -  '("expression"
>> +  '("expression" ;; SHOULD NOT MATCH "expression_statement", BUT SHOULD MATCH "parenthesized_expression"
>> +    "parenthesized_expression"
>> +    "formal_parameters"
>>      "pattern"
>>      "array"
>>      "function"
>> @@ -3845,7 +3847,13 @@ js--treesit-sexp-nodes
>>      "undefined"
>>      "arguments"
>>      "pair"
>> -    "jsx")
>> +    "jsx"
>> +    "statement_block"
>> +    "object"
>> +    "object_pattern"
>> +    "named_imports"
>> +    "class_body"
>> +    )
>>    "Nodes that designate sexps in JavaScript.
>>  See `treesit-sexp-type-regexp' for more information.")
>>  @@ -3893,7 +3901,7 @@ js-ts-mode
>>                  (regexp-opt js--treesit-sentence-nodes))
>>        (setq-local treesit-sexp-type-regexp
>> -                (regexp-opt js--treesit-sexp-nodes))
>> +                (rx-to-string `(seq bol (or ,@js--treesit-sexp-nodes) eol)))
>>        ;; Fontification.
>>      (setq-local treesit-font-lock-settings js--treesit-font-lock-settings)
> 


Actually, would it make sense to define sexp as “anything but some very small punctuation and delimiters”? I changed the definition of c-ts-mode-sexp-type-regexp to that (see bug#62302). It seems to work just fine. Of course, if there are problems we can revert back.

Yuan



This bug report was last modified 2 years and 96 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.