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

Use ThemeColor and add support for light themes #1299

Merged
merged 2 commits into from May 21, 2019

Conversation

lnicola
Copy link
Member

@lnicola lnicola commented May 21, 2019

Part of #1294.

  • switch to ThemeColor
  • add light and high contrast theme definitions
  • highlight control flow keywords and unsafe

Copy link
Member

@matklad matklad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

}
},
{
"id": "ralsp.control",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an easy way to allow both

  • highligting all keywords the same (this is what I personally prefer)
  • highlight various different classes of keywords differently

Perhaps we should just name classes ralsp.keyword, ralsp.keyword.controlflow, ralsp.keyword.unsafe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. I used ralsp.keyword.control to match the default theme (keyword.control).

"id": "ralsp.keyword",
"description": "Color for keywords",
"defaults": {
"dark": "#F0DFAF",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I'd be perfectly fine with picking a color from default dark theme. This is now configurable, so I can just specify zenburn colors in my config

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I switched to the default colors.

@@ -11,6 +11,14 @@ pub struct HighlightedRange {
pub tag: &'static str,
}

fn is_control_keyword(kind: SyntaxKind) -> bool {
match kind {
FOR_KW | LOOP_KW | WHILE_KW | CONTINUE_KW | BREAK_KW | IF_KW | ELSE_KW | MATCH_KW
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new syntax for this is

match kind {
    T![for], T![loop], ...
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that better? 😅

Updated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is, but the beauty is in the eye of the beholder :)

@matklad
Copy link
Member

matklad commented May 21, 2019

Thanks!

bors r+

bors bot added a commit that referenced this pull request May 21, 2019
1299: Use ThemeColor and add support for light themes r=matklad a=lnicola

Part of #1294.

- switch to `ThemeColor`
- add light and high contrast theme definitions
- highlight control flow keywords and `unsafe`


Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
@bors
Copy link
Contributor

bors bot commented May 21, 2019

Build succeeded

@bors bors bot merged commit b08362f into rust-lang:master May 21, 2019
@lnicola lnicola deleted the code-color branch May 21, 2019 14:11
},
{
"id": "ralsp.macro",
"description": "Color for DFAF8F",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't be it Color for macros?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, fixed in #1305.

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 this pull request may close these issues.

None yet

3 participants