[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#61303: 29.0.60; rust-ts-mode does not consistently fontify nested ma
From: |
Theodor Thornhill |
Subject: |
bug#61303: 29.0.60; rust-ts-mode does not consistently fontify nested macro-invocations |
Date: |
Sun, 05 Feb 2023 23:22:18 +0100 |
Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
> Hey there.
>
Hi!
> Thanks for another tree-sitter based mode to hack at :D
>
> I think I've found an error/lacking in rust-ts-mode where we may have to move
> upstream to fix it.
>
> Consider the following contrived (and yes, not very idiomatic) rust-code:
>
> let result = format!("{}{}",
> "Well yes",
> format!("Or {} no?", "possibly"));
>
> With rust-ts-mode first format! invocation will get highlighted as a
> macro-invocation, while the second will not.
>
> Inspecting this using treesit-explore-mode, I get the following tree:
>
> (let_declaration let pattern: (identifier) =
> value:
> (macro_invocation macro: (identifier) !
> (token_tree (
> (string_literal " ")
> (string_literal " ")
> (identifier)
> (token_tree (
> (string_literal " ")
> (string_literal " ")
> ))
> )))
> ;)
>
> Notice the lack of a second/nested "macro_invocation"-node. Instead the second
> macro is just denoted as a "identifier".
>
> To fix this, we'll probably need to upstream some bug-reports and PRs?
Sounds like it! Just in case - the code compiles, right?
Theo