Skip to content

Editor.TokenColorCustomizations#29393

Merged
aeschli merged 4 commits intomicrosoft:masterfrom
hoovercj:customThemes
Jul 7, 2017
Merged

Editor.TokenColorCustomizations#29393
aeschli merged 4 commits intomicrosoft:masterfrom
hoovercj:customThemes

Conversation

@hoovercj
Copy link
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 hoovercj changed the title First mostly-working prototype First mostly-working commit Jun 25, 2017
@hoovercj
Copy link
Member Author

@aeschli

@aeschli
Copy link
Contributor

aeschli commented Jun 26, 2017

Thanks @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 hoovercj changed the title First mostly-working commit Editor.TokenColorCustomizations Jun 26, 2017
@hoovercj
Copy link
Member Author

I absolutely agree with waiting for the next release, @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
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
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
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
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
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
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
Copy link
Member Author

hoovercj commented Jul 7, 2017

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

@aeschli aeschli merged commit d05ea1a into microsoft:master Jul 7, 2017
@aeschli
Copy link
Contributor

aeschli commented Jul 7, 2017

All looks good, thanks @hoovercj !

@khaosdoctor
Copy link

Image

@vytautas-pranskunas-
Copy link

Will it be whole scopes list?

@mscottfowler
Copy link

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
Copy link
Member Author

hoovercj commented Aug 17, 2017

@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

mscottfowler commented Aug 17, 2017 via email

@Mac-DevOSYandex
Copy link

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

@hoovercj
Copy link
Member Author

hoovercj commented Jan 7, 2019

@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
Copy link

Mac-DevOSYandex commented Jan 9, 2019 via email

@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