Skip to content

Commit

Permalink
Remove objectscript.ignoreInstallServerManager setting (#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-bsaviano authored Mar 28, 2024
1 parent 2f4d263 commit 2b84f09
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 63 deletions.
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1477,11 +1477,6 @@
"default": false,
"description": "Output in JSON format the action that VS Code should perform as requested by the server."
},
"objectscript.ignoreInstallServerManager": {
"type": "boolean",
"default": false,
"markdownDescription": "Do not offer to install the [intersystems-community.servermanager](https://marketplace.visualstudio.com/items?itemName=intersystems-community.servermanager) extension."
},
"objectscript.autoShowTerminal": {
"description": "Automatically show terminal when connected to docker-compose.",
"type": "boolean",
Expand Down
68 changes: 10 additions & 58 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,52 +473,6 @@ function setConnectionState(configName: string, active: boolean) {
return connConfig.update("conn", { ...targetConfig, active }, target);
}

// Promise to return the API of the servermanager
async function serverManager(): Promise<any> {
let extension = vscode.extensions.getExtension(smExtensionId);
const ignore =
config("ignoreInstallServerManager") ||
vscode.workspace.getConfiguration("intersystems.servers").get("/ignore", false);
if (!extension) {
if (ignore) {
return;
}
try {
await vscode.commands.executeCommand("extension.open", smExtensionId);
} catch (ex) {
// Such command do not exists, suppose we are under Theia, it's not possible to install this extension this way
return;
}
await vscode.window
.showInformationMessage(
`The [InterSystems Server Manager extension](https://marketplace.visualstudio.com/items?itemName=${smExtensionId}) is recommended to help you [define connections and store passwords securely](https://docs.intersystems.com/components/csp/docbook/DocBook.UI.Page.cls?KEY=GVSCO_config#GVSCO_config_addserver) in your keychain.`,
"Install",
"Later",
"Never"
)
.then(async (action) => {
switch (action) {
case "Install":
await vscode.commands.executeCommand("workbench.extensions.search", `@tag:"intersystems"`).then(null, null);
await vscode.commands.executeCommand("workbench.extensions.installExtension", smExtensionId);
extension = vscode.extensions.getExtension(smExtensionId);
break;
case "Never":
config().update("ignoreInstallServerManager", true, vscode.ConfigurationTarget.Global);
break;
case "Later":
default:
}
});
}
if (extension) {
if (!extension.isActive) {
await extension.activate();
}
return extension.exports;
}
}

function languageServer(install = true): vscode.Extension<any> {
let extension = vscode.extensions.getExtension(lsExtensionId);

Expand All @@ -534,19 +488,15 @@ function languageServer(install = true): vscode.Extension<any> {
}
await vscode.window
.showInformationMessage(
`Install the [InterSystems Language Server extension](https://marketplace.visualstudio.com/items?itemName=${lsExtensionId}) for best handling of ObjectScript code.`,
`Install the [InterSystems Language Server extension](https://marketplace.visualstudio.com/items?itemName=${lsExtensionId}) for improved intellisense and syntax coloring for ObjectScript code.`,
"Install",
"Later"
)
.then(async (action) => {
switch (action) {
case "Install":
await vscode.commands.executeCommand("workbench.extensions.search", `@tag:"intersystems"`).then(null, null);
await vscode.commands.executeCommand("workbench.extensions.installExtension", lsExtensionId);
extension = vscode.extensions.getExtension(lsExtensionId);
break;
case "Later":
default:
if (action == "Install") {
await vscode.commands.executeCommand("workbench.extensions.search", `@tag:"intersystems"`).then(null, null);
await vscode.commands.executeCommand("workbench.extensions.installExtension", lsExtensionId);
extension = vscode.extensions.getExtension(lsExtensionId);
}
});
}
Expand Down Expand Up @@ -613,8 +563,10 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
extensionContext = context;
workspaceState.update("workspaceFolder", undefined);

// Get api for servermanager extension, perhaps offering to install it
serverManagerApi = await serverManager();
// Get api for servermanager extension
const smExt = vscode.extensions.getExtension(smExtensionId);
if (!smExt.isActive) await smExt.activate();
serverManagerApi = smExt.exports;

documentContentProvider = new DocumentContentProvider();
fileSystemProvider = new FileSystemProvider();
Expand Down Expand Up @@ -708,7 +660,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
const noLSsubscriptions: { dispose(): any }[] = [];
if (!languageServerExt) {
if (!config("ignoreInstallLanguageServer")) {
outputChannel.appendLine(`The intersystems.language-server extension is not installed or has been disabled.\n`);
outputChannel.appendLine("The intersystems.language-server extension is not installed or has been disabled.");
outputChannel.show(true);
}

Expand Down

0 comments on commit 2b84f09

Please sign in to comment.