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

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

bug#60484: 29.0.60; c-ts-mode: short tokens are not identified as type_i


From: Mohammed Sadiq
Subject: bug#60484: 29.0.60; c-ts-mode: short tokens are not identified as type_identifier
Date: Mon, 02 Jan 2023 18:50:03 +0530

On 2023-01-02 18:15, Eli Zaretskii wrote:
Date: Mon, 02 Jan 2023 18:13:34 +0530
From: Mohammed Sadiq <sadiq@sadiqpk.org>
Cc: 60484@debbugs.gnu.org

On 2023-01-02 17:45, Eli Zaretskii wrote:
>> Date: Mon, 02 Jan 2023 10:22:09 +0530
>> From: Mohammed Sadiq <sadiq@sadiqpk.org>
>>
>> Short tokens are not identified as type_identifier in GNU Emacs
>> c-ts-mode, but does work fine with tree-sitter playground[0].
>>
>> Say for example, 'a_type' in an empty buffer is identified as a
>> type_identifier in tree-sitter playground, but not in c-ts-mode,
>> while say, some longer tokens like 'window_type' is identified as
>> type_identifier.
>
> Where is it written that FOO_type is a type identifier?  is this
> something new in some recent C Standard?  Or is it just a popular
> convention?

'a_type' was just a made up example, it can be any valid token, say
'g_file', or whatever.  I was pointing out a disparity in handling of
some token in c-ts-mode and tree-sitter: tree-sitter identifiers a 6
byte length token as an identifier, but c-ts-mode requires it to be
at least 11 byte sized for custom types.

I'm not sure I see a problem here.  It sounds like different
heuristics to me.  Nothing says that g_file is a type, only its
parsing can tell.

well, c-ts-mode uses tree-sitter-c under the hood, so it's not supposed to
behave differently.

Anyway, my use case is that I use ';' after a token to convert the preceding
token (if type) to a camel case and insert a *.

So: typing g_file; shall be converted to GFile * (but it works only if g_file is identified as a type identifier, which is not the case now). I already does '_' on SPC and S-SPC shall insert a real space. Sorry for that my use case
could be a really weird one. ;)


cheers,
Mohammed Sadiq





reply via email to

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