-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
rust: add highlight scope for type parameters #8660
rust: add highlight scope for type parameters #8660
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
There is also fn foo<T = Roo>() {
} with an AST of
|
Thanks for catching that @kirawi, I pushed a commit to handle that case |
Love it. Thanks! As you mentioned, that would be awesome for other languages like TypeScript as well. |
@cd-a I was planning on doing TypeScript next 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is generally a nice feature. Note that #1151 will cause issues here more frequently since generieren parameters often have larger scopes than function Parameters (impl Block in rust for example)
* rust: add highlight scope for type parameters * handle optional type parameters
* rust: add highlight scope for type parameters * handle optional type parameters
* rust: add highlight scope for type parameters * handle optional type parameters
* rust: add highlight scope for type parameters * handle optional type parameters
* rust: add highlight scope for type parameters * handle optional type parameters
Highly generic code can be challenging to read when type parameters are highlighted the same as other types. This is especially true when the type parameters are not single letters, e.g.
Fut
is somewhat common in Rust.So this PR adds a new highlighting scope for type parameters. I added it only for Rust as a proof-of-concept, but if accepted I'll update the queries for any other languages I'm familiar with (either in this PR or in a follow-up, whichever is preferred).
Here is a before and after with my in-progress port of the Codely theme.