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

How to use this extension? #4

Closed
dbeckwith opened this issue Nov 7, 2020 · 7 comments
Closed

How to use this extension? #4

dbeckwith opened this issue Nov 7, 2020 · 7 comments

Comments

@dbeckwith
Copy link

I installed this extension because I thought the default Rust syntax highlighting was lacking in VS Code, but I can't figure out how to get VS Code to use it. I also have the official rust-analyzer extension installed, and I saw #1, but I'm confused as to how to change the grammar association for Rust. I tried disabling the VS Code builtin Rust syntax extension, but now Rust files have no highlighting at all. Any ideas?

@dustypomerleau
Copy link
Owner

dustypomerleau commented Nov 7, 2020

Hi, @dbeckwith. If you have enabled Rust Analyzer, then you don't need this extension. My grammar is merged into Rust Analyzer, and RA's grammar overrides others when it starts. However, you won't see highlighting based on Textmate scopes unless you have semantic highlighting disabled in VS Code.

@dbeckwith
Copy link
Author

Hmm okay, could it just be an issue with my theme then? It seems like most things are colored yellow in my theme and there isn't enough variation. I'm using the Cobalt2 theme.
image

@dustypomerleau
Copy link
Owner

The Textmate grammar only provides the scopes. If you don't like the color applied to one of the tokens, you can override it in settings.json. It just happens that your theme is using the same color for storage, entity.name..., and function. You can see the scope names for customization using Developer: Inspect Editor Tokens And Scopes.

@dbeckwith
Copy link
Author

Okay thanks, I'll try customizing it. Do you have an example theme that assigns different colors to the different scopes that I could try to verify that it's working? Like the one in the screenshot in the README?

@dustypomerleau
Copy link
Owner

My Yarra Valley theme should work. There is a screenshot of Rust code in the README.

@dbeckwith
Copy link
Author

Thanks!

With your theme I think I was able to find a parsing bug haha. The macro metavariable type path looks like it's being parsed as pat:
image

@dustypomerleau
Copy link
Owner

Thanks for catching that—I have pushed a fix.

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

No branches or pull requests

2 participants