Skip to content

Commit e136337

Browse files
authored
Merge pull request #188 from intersystems-community/servermanager_optional
Make ServerManager extension as optional, do not prevent this extension working.
2 parents 47b4b9c + 02e9519 commit e136337

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

package.json

Lines changed: 6 additions & 4 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": [
@@ -715,7 +712,12 @@
715712
"objectscript.studioActionDebugOutput": {
716713
"type": "boolean",
717714
"default": false,
718-
"description": "Output the action that VSCode should perform as requested by the server in JSON format."
715+
"description": "Output the action that VS Code should perform as requested by the server in JSON format."
716+
},
717+
"objectscript.ignoreInstallServerManager": {
718+
"type": "boolean",
719+
"default": false,
720+
"markdownDescription": "Do not offer to install the [intersystems-community.servermanager](https://marketplace.visualstudio.com/items?itemName=intersystems-community.servermanager) helper extension."
719721
}
720722
}
721723
},

src/extension.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,37 @@ 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+
"The InterSystems® Server Manager extension is recommended to help you define connections.",
267+
"Install",
268+
"Skip",
269+
"Ignore"
270+
)
271+
.then(async (action) => {
272+
switch (action) {
273+
case "Install":
274+
await vscode.commands.executeCommand("workbench.extensions.search", `@tag:"intersystems"`);
275+
await vscode.commands.executeCommand("extension.open", extId);
276+
await vscode.commands.executeCommand("workbench.extensions.installExtension", extId);
277+
break;
278+
case "Ignore":
279+
config().update("ignoreInstallServerManager", true, vscode.ConfigurationTarget.Global);
280+
break;
281+
case "Skip":
282+
default:
283+
}
284+
});
285+
}
286+
256287
export async function activate(context: vscode.ExtensionContext): Promise<void> {
257288
if (!packageJson.version.includes("SNAPSHOT")) {
258289
reporter = new TelemetryReporter(extensionId, extensionVersion, aiKey);
@@ -540,6 +571,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
540571
...proposed
541572
);
542573
reporter && reporter.sendTelemetryEvent("extensionActivated");
574+
575+
// offer to install servermanager extension
576+
await serverManager();
543577
}
544578

545579
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)