helix/runtime/queries/rust
Michael Davis 86f10ae24c
Add a language to fix Rust highlights in format-args macros
This is a bit hacky. Injections cannot stack on each other like
highlights because layers can have their own injections. So this new
language `rust-format-args-macro` emulates that. It unconditionally
injects `rust-format-args` into all strings. Rust injects this new
language into known format-args macros like `println!`.

The downside is that this can cause false-positive highlights within
these macros for strings which happen to contain format-args syntax

    println!("Hello, {}!", "{}");
    //               ^ format args syntax
    //                      ^ not format args syntax, but highlighted
    //                        as if it were :(

This false-positive case is expected to be rare.

Injecting this fake language fixes regular non-string highlights in
macro invocations: macro invocations need to inject the entire token
tree and use `injection.include-children` for proper highlighting.
2025-07-13 12:01:18 -04:00
..
highlights.scm fix: Rust now correctly highlights doc comments as @comment.{block,line}.documentation instead of @comment 2025-06-10 10:54:05 -04:00
indents.scm Improve C, Rust & Python indent queries & add @align captures. 2023-08-11 23:44:02 +09:00
injections.scm Add a language to fix Rust highlights in format-args macros 2025-07-13 12:01:18 -04:00
locals.scm queries: Fix Rust function parameter locals tracking (#13828) 2025-06-24 08:08:25 -05:00
textobjects.scm Fix typos (#12690) 2025-02-02 18:58:29 -06:00