1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 13:32:50 -05:00

matugen: fix vscode editor color reload

This commit is contained in:
bbedward
2025-12-17 23:40:09 -05:00
parent f0f5bcc630
commit 8745f98c95
2 changed files with 22 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ function activate(context) {
if (!watcher) return;
const reloadTheme = (uri) => {
const reloadTheme = () => {
if (reloadTimeout) clearTimeout(reloadTimeout);
reloadTimeout = setTimeout(async () => {
@@ -47,13 +47,28 @@ function activate(context) {
return;
}
if (!themeData?.colors) return;
const themeKey = `[${currentTheme}]`;
await config.update(
"colorCustomizations",
{ "[Dynamic Base16 DankShell]": themeData.colors },
vscode.ConfigurationTarget.Global
);
if (themeData.colors) {
const colorConfig = config.get("colorCustomizations") || {};
colorConfig[themeKey] = themeData.colors;
await config.update(
"colorCustomizations",
colorConfig,
vscode.ConfigurationTarget.Global
);
}
if (themeData.tokenColors) {
const editorConfig = vscode.workspace.getConfiguration("editor");
const tokenConfig = editorConfig.get("tokenColorCustomizations") || {};
tokenConfig[themeKey] = { textMateRules: themeData.tokenColors };
await editorConfig.update(
"tokenColorCustomizations",
tokenConfig,
vscode.ConfigurationTarget.Global
);
}
}, 150);
};