Subject: bug#64830: 30.0.50 C++ treesitter mode no coloration

From: Eli Zaretskii <[email-masked]>
Date: Sun, 25 Aug 2024 07:54:43 +0300

> Date: Sun, 25 Aug 2024 02:19:28 +0000
> Cc: Eli Zaretskii <[email-masked]>, [email-masked]
> From: Alan Mackenzie <[email-masked]>
> 
> I've now applied your patch, the one whose first hunk's header is:
> 
> @@ -537,6 +537,16 @@ c-ts-mode--top-level-label-matcher
> 
> , but it unfortunately doesn't solve the bug.  On templates-21.cc, one of
> the test files from CC Mode, on doing M-x c++-ts-mode, there is no
> fontification at all.  In *Messages* we have
> 
> Error during redisplay: (jit-lock-function 1) signaled
> (treesit-query-error "Node type error at" 677 "[\"_Atomic\" \"break\"
> \"case\" \"const\" \"continue\" \"default\" \"do\" \"else\" \"enum\"
> \"extern\" \"for\" \"goto\" \"if\" \"inline\" \"register\" \"restrict\"
> \"return\" \"sizeof\" \"static\" \"struct\" \"switch\" \"typedef\"
> \"union\" \"volatile\" \"while\" \"and\" \"and_eq\" \"bitand\" \"bitor\"
> \"catch\" \"class\" \"co_await\" \"co_return\" \"co_yield\" \"compl\"
> \"concept\" \"consteval\" \"constexpr\" \"constinit\" \"decltype\"
> \"delete\" \"explicit\" \"final\" \"friend\" \"mutable\" \"namespace\"
> \"new\" \"noexcept\" \"not\" \"not_eq\" \"operator\" \"or\" \"or_eq\"
> \"override\" \"private\" \"protected\" \"public\" \"requires\"
> \"template\" \"throw\" \"try\" \"typename\" \"using\" \"xor\" \"xor_eq\"]
> @font-lock-keyword-face (auto) @font-lock-keyword-face (this)
> @font-lock-keyword-face (virtual) @font-lock-keyword-face" "Debug the
> query with `treesit-query-validate'")
> 
> That "Node type error at" 677 isn't a buffer position - the buffer is
> only 325 characters long.
> 
> Is there anything else I could do to help, here?

AFAIR, you still didn't respond to my questions about the version of
the C++ grammar library you are using, nor tried to upgrade to the
latest version of that grammar library.

FTR, I'm using tree-sitter version 0.20.8 and grammar library from
their Git repository as of June 17 (this is version 0.22.2 of the
grammar library with a couple of changes after that version).  I have
no problems with displaying C++ files whatsoever, and *Messages* is
clean.  I also tried the latest version of the grammar library
(0.22.3), and didn't see any problems there, either.