-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Extended theme customisation syntax #122969
Conversation
Multiple scopes per customisation Wildcard scopes using `...`
@@ -635,7 +668,7 @@ export class ColorThemeData implements IWorkbenchColorTheme { | |||
} | |||
|
|||
function toCSSSelector(extensionId: string, path: string) { | |||
if (startsWith(path, './')) { | |||
if (path.startsWith('./')) { |
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.
Used String.startsWith
to pass code hygiene test.
Can you describe in the description what problem you want to solve and how what syntax you propose? |
Done. |
Do I change the configuration schema? vscode/src/vs/workbench/services/themes/common/themeConfiguration.ts Lines 199 to 206 in 412ee9a
Late addition - how do I add tests? |
Enable subloop key index by removing Iterable assert and for-of
A) Test rerun please B) few questions above. |
We currently have no tests covering how the settings are read out. If you want to add unit tests for your code, that would be welcome. They would go to Not sure what you mean by |
I've read the JSON schema doc. But I'm still unsure on how I implement the code completion on multiple scopes e.g. |
The schema based completions are too limited, but validation will work. Better completions could be added programmatically, but I don't think we should go there. You can add some |
Hmm. Alright. Should I remove autocompletion of |
The completions for single theme customizations (what we currently support) can stay in, no? |
Alright, I'll look into the |
I don't understand how to write tests, nor what naming convention to use. |
@4086606 That's ok. Let me know when the PR is ready to be reviewed |
|
Introduce concept of theme scopes in the theme setting types. Template literal types are broken in vscode repo, so we dupe interfaces.
Using this pattern, I can create scoped property types:
|
[styleRuleOrThemeSettingsId: string]: ISemanticTokenRules | ISemanticTokenColorCustomizations | boolean | undefined; | ||
} | ||
|
||
export interface IThemeScopedExperimentalSemanticTokenColorCustomizations { |
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.
Tongue twister of a name 🙈 any suggestions or is verbose better
After second thought, the changes to |
Thanks a lot, @4086606 , and sorry for the wait! |
Closes #103694.
[scope]
per customisation*
Similar themes in large packs might need to be customised the same way.
Can lead to verbose code as explained in #103694 (already existent):
This pull adds a new syntax that shortens all of that to 1 wildcard scope:
The
*
wildcards matches zero or more of any character.Multiple scopes are legal, delimited by the regex
/\]\s*\[/
. This will enhance settings.json keys:workbench.colorCustomizations
editor.colorCustomizations
editor.tokenColorCustomizations
editor.semanticTokenColorCustomizations
@aeschli