From 7af9cc38d4a3675b902c147574425c0e47e5fcb1 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Sat, 18 May 2024 18:36:22 +0200 Subject: [PATCH] Add option to skip future server install confirmations --- .../configuration/galaxyToolWorkspaceConfiguration.ts | 11 +++++++---- client/src/configuration/workspaceConfiguration.ts | 1 + client/src/setup.ts | 7 ++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/client/src/configuration/galaxyToolWorkspaceConfiguration.ts b/client/src/configuration/galaxyToolWorkspaceConfiguration.ts index 4eb338c..79e8989 100644 --- a/client/src/configuration/galaxyToolWorkspaceConfiguration.ts +++ b/client/src/configuration/galaxyToolWorkspaceConfiguration.ts @@ -26,10 +26,13 @@ export class GalaxyToolsWorkspaceConfiguration implements IWorkspaceConfiguratio } class GalaxyLanguageServerConfiguration implements IServerConfiguration { - constructor(private readonly config: WorkspaceConfiguration) {} + constructor(private readonly config: WorkspaceConfiguration) { } silentInstall(): boolean { return this.config.get("server.silentInstall", false); } + setSilentInstall(value: boolean, global: boolean = true): void { + this.config.update("server.silentInstall", value, global); + } } class GalaxyToolsPlanemoConfiguration implements IPlanemoConfiguration { @@ -68,14 +71,14 @@ class GalaxyToolsPlanemoConfiguration implements IPlanemoConfiguration { if (!validPlanemo) { result.addErrorMessage( "Please set a valid [Env Path](command:galaxytools.planemo.openSettings)" + - " value for planemo in the [Settings](command:galaxytools.planemo.openSettings)." + " value for planemo in the [Settings](command:galaxytools.planemo.openSettings)." ); } if (!validGalaxyRoot) { result.addErrorMessage( "Please set a valid [Galaxy Root](command:galaxyTools.planemo.openSettings)" + - " for planemo in the [Settings](command:galaxytools.planemo.openSettings)." + " for planemo in the [Settings](command:galaxytools.planemo.openSettings)." ); } @@ -102,7 +105,7 @@ class GalaxyToolsPlanemoConfiguration implements IPlanemoConfiguration { } class GalaxyToolsPlanemoTestingConfiguration implements IPlanemoTestingConfiguration { - constructor(private readonly config: WorkspaceConfiguration) {} + constructor(private readonly config: WorkspaceConfiguration) { } enabled(): boolean { return this.config.get("planemo.testing.enabled", true); diff --git a/client/src/configuration/workspaceConfiguration.ts b/client/src/configuration/workspaceConfiguration.ts index 6d09d55..4676f4f 100644 --- a/client/src/configuration/workspaceConfiguration.ts +++ b/client/src/configuration/workspaceConfiguration.ts @@ -24,6 +24,7 @@ export namespace Settings { export interface IServerConfiguration { silentInstall(): boolean; + setSilentInstall(value: boolean): void; } export interface IWorkspaceConfiguration { diff --git a/client/src/setup.ts b/client/src/setup.ts index d52bd10..f0789cf 100644 --- a/client/src/setup.ts +++ b/client/src/setup.ts @@ -5,6 +5,7 @@ import { commands, ExtensionContext, ProgressLocation, Uri, window, workspace } import { LocalStorageService } from "./configuration/storage"; import { Constants } from "./constants"; import { execAsync, forceDeleteDirectory as removeDirectory } from "./utils"; +import { DefaultConfigurationFactory } from "./planemo/configuration"; /** * Ensures that the Language server is installed in the extension's virtual environment @@ -39,7 +40,7 @@ export async function installLanguageServer( if (storedPython === null && !isSilentInstall) { const result = await window.showInformationMessage( `Galaxy Tools needs to install the Galaxy Language Server Python package to continue. This will be installed in a virtual environment inside the extension and will require Python ${Constants.REQUIRED_PYTHON_VERSION}`, - ...["Install", "More Info"] + ...["Install", "More Info", "Don't ask again"] ); if (result === undefined) { @@ -52,6 +53,10 @@ export async function installLanguageServer( "https://github.com/galaxyproject/galaxy-language-server/blob/main/client/README.md#installation" ) ); + } else if (result === "Don't ask again") { + // Set user preference to silent install + const configFactory = new DefaultConfigurationFactory(); + configFactory.getConfiguration().server().setSilentInstall(true); } }