Skip to content

Remove objectscript.ignoreInstallServerManager setting #1339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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