Skip to content

Commit

Permalink
Merge pull request #252 from galaxyproject/add_option_dont_ask_for_in…
Browse files Browse the repository at this point in the history
…stall

Add option to skip future server install confirmations
  • Loading branch information
davelopez authored May 18, 2024
2 parents 100cca7 + 7af9cc3 commit 14d8d61
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
11 changes: 7 additions & 4 deletions client/src/configuration/galaxyToolWorkspaceConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)."
);
}

Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions client/src/configuration/workspaceConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export namespace Settings {

export interface IServerConfiguration {
silentInstall(): boolean;
setSilentInstall(value: boolean): void;
}

export interface IWorkspaceConfiguration {
Expand Down
7 changes: 6 additions & 1 deletion client/src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
}
}

Expand Down

0 comments on commit 14d8d61

Please sign in to comment.