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

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

bug#62086: 29.0.60; ruby-ts-mode regressions


From: Yuan Fu
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@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




reply via email to

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