I has originally named this feature `auto_read`, but changed the name to `auto_reload`, this changes some references I forgot to update to the new name
Implements the idea raised by @porridgewithraisins in this comment:
https://github.com/helix-editor/helix/issues/1125#issuecomment-3073782827
The implementation was modeled after the implementation of the autosave feature.
Here are some example snippets of configuration for this feature:
- disable auto-reloading (default)
```toml
[editor]
auto-reload = false
```
or
```toml
[editor.auto-reload]
focus-gained = false
```
- auto-reload on focus
```toml
[editor]
auto-reload = true
```
or
```toml
[editor.auto-reload]
focus-gained = true
```
- auto-reload at some periodically at time interval (5 seconds in this example)
```toml
[editor.auto-reload]
periodic.enable = true
periodic.interval = 5000
```
- of course, you could have it reload on focus and at an interval too:
```toml
[editor.auto-reload]
focus-gained = true
periodic.enable = true
periodic.interval = 5000
```
Since tree-house is young and we've seen a few bugs that make it go
backwards, we should handle this case gracefully and just give up on
syntax highlighting with an error log.
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.
The gbprod grammar is more complete and featureful than mine, and more
actively maintained. I will archive my tree-sitter-git-commit in favor
of gbprod's.
The new queries are based on the ones in the repo upstream but I
modified them to look similar to the highlights before this commit.
Also I've updated the tab-width so that change nodes in the generated
message are indented correctly.