Skip to content

Non control-flow keywords #5

Closed
@cynecx

Description

@cynecx

See microsoft/vscode#108254 (comment) (and rust-lang/rust-analyzer#6137 (comment)).

This does affect even more keywords (other than fn and use):

...
{
                    "comment": "control flow keywords",
                    "name": "keyword.control.rust",
                    "match": "\\b(async|await|break|continue|do|else|for|if|loop|match|move|return|try|where|while|yield)\\b"
                },
...

move and where do not cause control-flow either.

Also this:

"comment": "constant declarations",
"match": "\\b(const)\\s+([A-Z][A-Za-z0-9_]*)\\b",
"captures": {
"1": {
"name": "keyword.control.rust"
},

contradicts:

"comment": "storage keywords",
"name": "storage.type.rust",
"match": "\\b(const|enum|extern|let|macro|mod|struct|trait|type)\\b"
},

EDIT: The same applies to the async keyword, it doesn't cause control-flow, it's merely a specifier/modifier.

The for keyword may not be used as a control-flow keyword, as it can be used in hrtb context (for<'a> ...). Howver, I am not quite sure how the old grammar dealt with that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions