Skip to content

Rust: A for loop with an open range breaks syntax highlighting for the next keyword #3463

Closed
@Omnikar

Description

@Omnikar

Summary

When editing a Rust file with Helix, the behaviour described in the title occurs (details below).

Reproduction Steps

Minimal reproducible example:

fn main() {
    for _ in 0.. {
        break;
    }
    let a = 1;
    let b = 2;
}

Expected result:
All keywords (fn, for, and both lets) are highlighted correctly.

Actual result:
The first let (in let a…) is not highlighted, while all other keywords in the code snippet, including the second let, are highlighted correctly. This first let can be replaced with another keyword, like for, while, const, static, return, and whatnot. The lack of syntax highlighting always applies only to the first keyword after the for loop.

Helix log

Nothing of interest.

Platform

MacOS

Terminal Emulator

iTerm2 v3.4.16

Helix Version

Helix 22.05 (8deaebde)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tree-sitterArea: Tree-sitterC-bugCategory: This is a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions