Skip to content

Commit 231bcfb

Browse files
authored
Use new Modern themes when loading Studio syntax colors (#1264)
1 parent 9a15c3f commit 231bcfb

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

package-lock.json

Lines changed: 15 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,6 +1684,7 @@
16841684
"@types/istextorbinary": "2.3.1",
16851685
"@types/mocha": "^7.0.2",
16861686
"@types/node": "^14.18.0",
1687+
"@types/semver": "7.5.4",
16871688
"@types/vscode": "1.75.0",
16881689
"@types/ws": "8.5.4",
16891690
"@types/xmldom": "^0.1.29",

src/commands/studioMigration.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import * as vscode from "vscode";
22
import cmd = require("node-cmd");
33
import util = require("util");
4+
import { gte } from "semver";
5+
46
import { fileExists, outputChannel } from "../utils";
57

68
/** Run a command using `node-cmd` and return a Promise */
@@ -323,19 +325,22 @@ export async function loadStudioColors(languageServerExt: vscode.Extension<any>
323325
128
324326
? "Dark"
325327
: "Light";
328+
const themeName = `InterSystems Default ${darkLight}${
329+
gte(languageServerExt.packageJSON.version, "2.4.0") ? " Modern" : ""
330+
}`;
326331

327332
// Modify the theme
328333
const editorConfig = vscode.workspace.getConfiguration("editor");
329334
const workbenchConfig = vscode.workspace.getConfiguration("workbench");
330335
const tokensConfig = editorConfig.get("semanticTokenColorCustomizations");
331-
tokensConfig[`[InterSystems Default ${darkLight}]`] = { rules };
336+
tokensConfig[`[${themeName}]`] = { rules };
332337
await editorConfig.update("semanticTokenColorCustomizations", tokensConfig, true);
333338
const colorsConfig = workbenchConfig.get("colorCustomizations");
334-
colorsConfig[`[InterSystems Default ${darkLight}]`] = { "editor.background": editorBackground };
339+
colorsConfig[`[${themeName}]`] = { "editor.background": editorBackground };
335340
await workbenchConfig.update("colorCustomizations", colorsConfig, true);
336341

337342
// Activate it globally
338-
await workbenchConfig.update("colorTheme", `InterSystems Default ${darkLight}`, true);
343+
await workbenchConfig.update("colorTheme", themeName, true);
339344
}
340345
)
341346
.then(

0 commit comments

Comments
 (0)