Skip to content

Syntax highlighting wrong for one character constants in Rust #3922

Closed
@A-Walrus

Description

@A-Walrus

Summary

Constants with one character names are incorrectly highlighted in Rust
They both have the same tree-sitter scopes:
Definition: scopes: ["source_file", "const_item", "identifier"]
Usage: scopes: ["source_file", "function_item", "block", "let_declaration", "identifier"]

image

const NUM: usize = 5;
const N: usize = 4;

fn f() {
    let a = N;
    let b = NUM;
}

Reproduction Steps

I tried this:

  1. hx file.rs file with code from above

I expected this to happen:
one letter constant "N" is highlighted the same as other constants

Instead, this happened:
It is highlighted the same as a "type_identifier"

Helix log

Nothing

Platform

Linux

Terminal Emulator

Gnome console

Helix Version

22.08.1

Metadata

Metadata

Assignees

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