mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 03:40:04 -04:00
highlights(rust): distinguish between "for" in loops and impl_item
Fixes #3641
This commit is contained in:
parent
9c3a1366bc
commit
53742779e3
2 changed files with 19 additions and 2 deletions
|
|
@ -211,13 +211,15 @@
|
||||||
[
|
[
|
||||||
"break"
|
"break"
|
||||||
"continue"
|
"continue"
|
||||||
"for"
|
|
||||||
"in"
|
"in"
|
||||||
"loop"
|
"loop"
|
||||||
"while"
|
"while"
|
||||||
] @repeat
|
] @repeat
|
||||||
|
|
||||||
|
(impl_item
|
||||||
|
"for" @keyword)
|
||||||
|
(for_expression
|
||||||
|
"for" @repeat)
|
||||||
|
|
||||||
;;; Operators & Punctuation
|
;;; Operators & Punctuation
|
||||||
|
|
||||||
|
|
|
||||||
15
tests/query/highlights/rust/for.rs
Normal file
15
tests/query/highlights/rust/for.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
struct Foo;
|
||||||
|
|
||||||
|
// Issue https://github.com/nvim-treesitter/nvim-treesitter/issues/3641
|
||||||
|
// Distinguish between for in loop or impl_item
|
||||||
|
impl Drop for Foo {
|
||||||
|
// ^ @keyword
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
for i in 0..128 {
|
||||||
|
// <- @repeat
|
||||||
|
println!("{i}");
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue