tree-sitter / tree-sitter-rust

Rust grammar for tree-sitter
MIT License
340 stars 97 forks source link

Add support for `if-let chain` #161

Closed faptc closed 1 year ago

faptc commented 1 year ago

if-let chain will soon be stable. Tracking issue for the feature: https://github.com/rust-lang/rust/issues/53667

The syntax is not highlighted correctly for the let keyword.

I have this code:

fn foo(b: bool, x: Option<u32>) {
    if b && let Some(x) = x {}
}

I expect the let keyword be highlighted.

Instead, let is not highlighted: image

AndyJado commented 1 year ago

perhaps let-else as well?

solidiquis commented 1 year ago

Yeah let-else and if-let chain would be nice.

Screen Shot 2023-04-13 at 1 13 05 PM