GNU bug report logs -
#59498
29.0.50; c++-ts-mode get wrong-type-argument error when enabled
Previous Next
Reported by: Eason Huang <aqua0210 <at> foxmail.com>
Date: Wed, 23 Nov 2022 02:26:02 UTC
Severity: normal
Tags: patch
Found in version 29.0.50
Fixed in version 29.1
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> On Nov 26, 2022, at 11:18 PM, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
>
>>> I added treesit-comment-start/end to help indenting comments. So this is
>>> the correct way to use them. The following comment explains why I created
>>> new variables:
>>>
>>> ;; `comment-start' and `comment-end' assume there is only one type of
>>> ;; comment, and that the comment spans only one line. So they are not
>>> ;; sufficient for our purpose.
>>
>> ??? This is surprisingly unclean, IMO. For starters, the names of the
>> variables are confusing. The need to define two sets of comment-start and
>> comment-end regexps is also a nuisance and a source of errors.
>>
>> How do non-treesit modes handle this issue? Why do the treesit-based modes
>> need something special here?
>>
>> Stefan, any ideas?
>
> `comment-start` and `comment-end` do not describe the set of possible
> comment delimiters. They describe the comment delimiters that should be
> *inserted* when we do things like `comment-dwim`.
>
> To find/match comment delimiters we have `comment-start-skip` and
> `comment-end-skip`. They're not ideal, but they've been good enough so far.
> They don't say which comment starter matches which comment-ender (that
> was done by the syntax-tables), but tree-sitter should be able to tell
> us that when we need it.
Ah, I should’ve done more research, sorry. comment-start/end-skip can completely replace treesit-comment-start/end.
> It would be nice if we could avoid the need to set/use
> `comment-start-skip` and `comment-end-skip` when using tree-sitter.
> Maybe we can compute their values from the tree-sitter grammar.
> But getting rid of uses of those vars will take a fair bit more work,
> I think.
Tree-sitter puts the whole comment in a single “comment” node, so there is no hope getting comment-start/end from it, sadly.
Yuan
This bug report was last modified 2 years and 231 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.