Skip to content

as should be a rustKeyword not rustOperator for syntax highlighting #493

@myarcana

Description

@myarcana

The as keyword is currently a rustOperator according to runtime/syntax/rust.vim, which is kind of surprising because in these kinds of expressions:

use foo as bar;
let thing1: u8 = 7 + 8 as u8;
use std::{mem as memory, net as network};

I expect as to always have the same highlighting as use and let, but not as = or +.

In fact in all rust documentation, it is highlighted as if it were a keyword, not an operator, and in every syntax highlighter online (e.g. right here, and in stackoverflow) it is also highlighted as if it were a keyword and not an operator.

As it stands, gruvbox (a universally loved colorscheme, the most popular Vim and neovim colorscheme) actually makes it look like the syntax file doesn't even support the language feature as.

Screenshot 2023-02-13 at 14 03 49

I think that's very ugly, and confusing. The disparity between everything you read in documentation and your local editor makes you question "is my runtime broken? up-to-date?"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions