GNU bug report logs -
#68993
treesitter support for forward-sexp-default-function
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Thu, 8 Feb 2024 17:42:01 UTC
Severity: normal
Fixed in version 30.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
>> The problem is that e.g. Ruby parser to such text:
>>
>> hash[:key]
>>
>> produces such syntax tree:
>>
>> (element_reference object: (identifier) [ (simple_symbol) ])
>>
>> so when point is on [ then 'C-M-f' can't move to ].
>>
>> This is fixed now by the third patch:
>> @@ -1170,7 +1170,20 @@ ruby-ts-mode
>> + (comment ,(lambda (node)
>> + (or (member (treesit-node-type node)
>> + '("comment" "string_content"))
>> + (and (member (treesit-node-text node)
>> + '("[" "]"))
>> + (equal (treesit-node-type
>> + (treesit-node-parent node))
>> + "element_reference"))
>> + (and (member (treesit-node-text node)
>> + '("#{" "}"))
>> + (equal (treesit-node-type
>> + (treesit-node-parent node))
>> + "interpolation"))))))))
>
> IIUC, this doesn’t look like a good idea: you don’t want to mark
> something that’s not comment as comment. In the future, other packages
> will start using these thing definitions, and I’m sure you don’t want
> them consider regular code as comments.
>
> For the specific problem you described, maybe the change made in #68899 can help?
bug#68899 can't help because it only fixes 'C-M-f' to move point to the
end of the current symbol.
Whereas for the problem above we need a predicate that will instruct
'treesit-forward-sexp' to fall back to 'forward-sexp-default-function'.
Clearly neither the name 'text' nor 'comment' would be suitable
for such usage. Maybe it's possible to find a different name?
This bug report was last modified 1 year and 92 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.