Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non control-flow keywords #5

Closed
cynecx opened this issue Nov 7, 2020 · 0 comments · Fixed by #6
Closed

Non control-flow keywords #5

cynecx opened this issue Nov 7, 2020 · 0 comments · Fixed by #6

Comments

@cynecx
Copy link
Contributor

cynecx commented Nov 7, 2020

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.

cynecx added a commit to cynecx/rust-syntax that referenced this issue Nov 7, 2020
bors bot added a commit to rust-lang/rust-analyzer that referenced this issue Nov 8, 2020
6497: vscode: fix tmGrammar issues around non-controlflow keywords r=dustypomerleau a=cynecx

Addresses some of the issues mentioned here: dustypomerleau/rust-syntax#5.
In sync with dustypomerleau/rust-syntax#6.

Co-authored-by: cynecx <me@cynecx.net>
dustypomerleau added a commit that referenced this issue Nov 8, 2020
fix non control-flow keywords (#5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant