Skip to content

Commit 7effe96

Browse files
committed
make servermanager optional
1 parent 7c940e2 commit 7effe96

File tree

3 files changed

+43
-3
lines changed

3 files changed

+43
-3
lines changed

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@
6464
"onDebugInitialConfigurations"
6565
],
6666
"main": "./dist/extension",
67-
"extensionDependencies": [
68-
"intersystems-community.servermanager"
69-
],
7067
"contributes": {
7168
"menus": {
7269
"commandPalette": [
@@ -712,6 +709,11 @@
712709
"type": "boolean",
713710
"default": false,
714711
"description": "Output the action that VSCode should perform as requested by the server in JSON format."
712+
},
713+
"objectscript.ignoreInstallServerManager": {
714+
"type": "boolean",
715+
"default": false,
716+
"markdownDescription": "Do not offer to install `#intersystems-community.servermanager#` extension"
715717
}
716718
}
717719
},

src/extension.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,40 @@ export const checkConnection = (clearCookies = false): void => {
253253
});
254254
};
255255

256+
async function serverManager(): Promise<void> {
257+
const extId = "intersystems-community.servermanager";
258+
const ignore =
259+
config("ignoreInstallServerManager") ||
260+
vscode.workspace.getConfiguration("intersystems.servers").get("/ignore", false);
261+
if (ignore || vscode.extensions.getExtension(extId)) {
262+
return;
263+
}
264+
return vscode.window
265+
.showInformationMessage(
266+
`Extension InterSystems® Server Manager have not installed,
267+
it's recommended to install it.`,
268+
"Install",
269+
"Skip",
270+
"Ignore"
271+
)
272+
.then(async (action) => {
273+
switch (action) {
274+
case "Install":
275+
await vscode.commands.executeCommand("workbench.extensions.installExtension", extId);
276+
// eslint-disable-next-line no-fallthrough
277+
case "View":
278+
await vscode.commands.executeCommand("workbench.extensions.search", `@tag:"intersystems"`);
279+
await vscode.commands.executeCommand("extension.open", extId);
280+
break;
281+
case "Ignore":
282+
config().update("ignoreInstallServerManager", true, vscode.ConfigurationTarget.Global);
283+
break;
284+
case "Skip":
285+
default:
286+
}
287+
});
288+
}
289+
256290
export async function activate(context: vscode.ExtensionContext): Promise<void> {
257291
if (!packageJson.version.includes("SNAPSHOT")) {
258292
reporter = new TelemetryReporter(extensionId, extensionVersion, aiKey);
@@ -540,6 +574,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
540574
...proposed
541575
);
542576
reporter && reporter.sendTelemetryEvent("extensionActivated");
577+
578+
// offer to install servermanager extension
579+
await serverManager();
543580
}
544581

545582
export function deactivate(): void {

test-fixtures/test.code-workspace

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"objectscript.conn": {
99
"active": false
1010
},
11+
"objectscript.ignoreInstallServerManager": true,
1112
"intersystems.servers": {
1213
}
1314
}

0 commit comments

Comments
 (0)