On Sun, Feb 5, 2023, at 23:22, Theodor Thornhill wrote:
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


Yes. This is compilable, runnable rust-code. 


Jostein