Skip to content

Editor.TokenColorCustomizations - #29393

Merged
Martin Aeschlimann (aeschli) merged 4 commits into
microsoft:masterfrom
hoovercj:customThemes
Jul 7, 2017
Merged

Martin Aeschlimann (aeschli) merged 4 commits into
microsoft:masterfrom
hoovercj:customThemes

Conversation

@hoovercj

Copy link
Copy Markdown
Member

Addresses #27894

theme_overrides1

Caveat: colors update quickly, but font style does not. It will only update font style if I modify an affected token as shown in the gif below. Any ideas on what might cause that behavior?

theme_overrides2

Also, this pack does not include defining the config schema

Caveat: colors update quickly, but font style does not.

Also, this pack does not include defining the config schema
@hoovercj Cody Hoover (hoovercj) changed the title First mostly-working prototype First mostly-working commit Jun 25, 2017
@hoovercj

Copy link
Copy Markdown
Member Author

@aeschli

Copy link
Copy Markdown
Contributor

Thanks Cody Hoover (@hoovercj) , very nice, it's exactly what I have imagined!
I added some comments. It's a bit tight for the June release as it is the last day of development for that release. I'd suggest to commit it for July so we can get insiders feedback.

About the issue of fontstyle changes not triggering a refresh: This sounds like a bug in the editor.

@hoovercj Cody Hoover (hoovercj) changed the title First mostly-working commit Editor.TokenColorCustomizations Jun 26, 2017
@hoovercj

Copy link
Copy Markdown
Member Author

I absolutely agree with waiting for the next release, Martin Aeschlimann (@aeschli). We've waited this long, what's one more month? :-)

You said that you added comments but I can't see any.

resultRules.push(rule);
if (!rule.scope) {
resultRules.push(rule); // push the rule
if (!rule.scope) { // if it doesn't have a scope...?? why?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not having a scope means is the set of default rules, such as the default background and foreground color. Each text mate theme has such a set of default rules, typically the first entry.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok, that makes sense, thanks!

// then find all the colorIds mapped to that setting, and set those to the color
// It is not yet clear to me what this looks like in practice
// * Remove all keys that aren't foreground or background
// Why remove fontstyle?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Removing fontstyle is an oversight, it should stay.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

When I go back in to remove my "question" comments, should I then also change if (key !== 'foreground' && key !== 'background') to if (key !== 'foreground' && key !== 'background' && key !== 'fontStyle')?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes

}
if (this.hasCustomizationChanged(newColorCustomizations, newColorIds)) {

let newRules = this.getTokenColorCustomizations();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Setting change notifications can happen quite often, cause by any change to settings. Mostly the change does not affect the custom colors. For that I tried to optimize the test for changes and avoid the creation of new data structures unless there is a change to the colors.
I'd suggest to not construct the rules array as in getTokenColorCustomizations, but just compare the old to the new settings.
The construction of the rules (as done in getTokenColorCustomizations) could be done inside setCustomTokenColors, like it is done with custom colors.

@hoovercj

Cody Hoover (hoovercj) commented Jul 7, 2017 •

Copy link
Copy Markdown
Member Author

Martin Aeschlimann (@aeschli) is there any more action needed from me before merging this and getting insiders feedback?

@aeschli
Martin Aeschlimann (aeschli) merged commit d05ea1a into microsoft:master Jul 7, 2017
@aeschli

Copy link
Copy Markdown
Contributor

All looks good, thanks Cody Hoover (@hoovercj) !

@khaosdoctor

Copy link
Copy Markdown

@vytautas-pranskunas-

Copy link
Copy Markdown

Will it be whole scopes list?

@mscottfowler

Copy link
Copy Markdown

Hi, just downloaded the new VS Code July 2017. Do you have a list of the syntax tokens available (comments, strings) for the editor.tokenColorCustomizations user setting?

@hoovercj

Cody Hoover (hoovercj) commented Aug 17, 2017 •

Copy link
Copy Markdown
Member Author

Scott Fowler (@mscottfowler) the intellisense for the setting should show you all the options. For example, this is the gif from the release notes:

img

You can see that comments, functions, keywords, numbers, strings, types, and variables are options. If you use any of these, you'll change all comments, functions, etc. to the color you set.

If you want to be more specific, you can set ANY scope you want in the textMateRules section. This, too, is shown in the release notes.

img2

To find the scopes that you need to use, open the command pallette and search "TM Scopes"
image

Then click anywhere in a file that you want to see what scopes are valid there.

image

I hope that helps!

@mscottfowler

Copy link
Copy Markdown

@Mac-DevOSYandex

Copy link
Copy Markdown

And WHY O Why.. has Microsoft VS Code not implemented this as a feature that's part of the customization?!

@hoovercj

Copy link
Copy Markdown
Member Author

Gio (@Mac-DevOSYandex) This is a merged pull request so could you elaborate on what you mean? What do you believe is not implemented?

@Mac-DevOSYandex

Gio (Mac-DevOSYandex) commented Jan 9, 2019 via email

Copy link
Copy Markdown

@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants