Skip to content

Commit

Permalink
Use new Modern themes when loading Studio syntax colors (#1264)
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-bsaviano authored Nov 2, 2023
1 parent 9a15c3f commit 231bcfb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
17 changes: 15 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1684,6 +1684,7 @@
"@types/istextorbinary": "2.3.1",
"@types/mocha": "^7.0.2",
"@types/node": "^14.18.0",
"@types/semver": "7.5.4",
"@types/vscode": "1.75.0",
"@types/ws": "8.5.4",
"@types/xmldom": "^0.1.29",
Expand Down
11 changes: 8 additions & 3 deletions src/commands/studioMigration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as vscode from "vscode";
import cmd = require("node-cmd");
import util = require("util");
import { gte } from "semver";

import { fileExists, outputChannel } from "../utils";

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

// Modify the theme
const editorConfig = vscode.workspace.getConfiguration("editor");
const workbenchConfig = vscode.workspace.getConfiguration("workbench");
const tokensConfig = editorConfig.get("semanticTokenColorCustomizations");
tokensConfig[`[InterSystems Default ${darkLight}]`] = { rules };
tokensConfig[`[${themeName}]`] = { rules };
await editorConfig.update("semanticTokenColorCustomizations", tokensConfig, true);
const colorsConfig = workbenchConfig.get("colorCustomizations");
colorsConfig[`[InterSystems Default ${darkLight}]`] = { "editor.background": editorBackground };
colorsConfig[`[${themeName}]`] = { "editor.background": editorBackground };
await workbenchConfig.update("colorCustomizations", colorsConfig, true);

// Activate it globally
await workbenchConfig.update("colorTheme", `InterSystems Default ${darkLight}`, true);
await workbenchConfig.update("colorTheme", themeName, true);
}
)
.then(
Expand Down

0 comments on commit 231bcfb

Please sign in to comment.