Skip to content

Commit 14d8d61

Browse files
authored
Merge pull request #252 from galaxyproject/add_option_dont_ask_for_install
Add option to skip future server install confirmations
2 parents 100cca7 + 7af9cc3 commit 14d8d61

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

client/src/configuration/galaxyToolWorkspaceConfiguration.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ export class GalaxyToolsWorkspaceConfiguration implements IWorkspaceConfiguratio
2626
}
2727

2828
class GalaxyLanguageServerConfiguration implements IServerConfiguration {
29-
constructor(private readonly config: WorkspaceConfiguration) {}
29+
constructor(private readonly config: WorkspaceConfiguration) { }
3030
silentInstall(): boolean {
3131
return this.config.get("server.silentInstall", false);
3232
}
33+
setSilentInstall(value: boolean, global: boolean = true): void {
34+
this.config.update("server.silentInstall", value, global);
35+
}
3336
}
3437

3538
class GalaxyToolsPlanemoConfiguration implements IPlanemoConfiguration {
@@ -68,14 +71,14 @@ class GalaxyToolsPlanemoConfiguration implements IPlanemoConfiguration {
6871
if (!validPlanemo) {
6972
result.addErrorMessage(
7073
"Please set a valid [Env Path](command:galaxytools.planemo.openSettings)" +
71-
" value for planemo in the [Settings](command:galaxytools.planemo.openSettings)."
74+
" value for planemo in the [Settings](command:galaxytools.planemo.openSettings)."
7275
);
7376
}
7477

7578
if (!validGalaxyRoot) {
7679
result.addErrorMessage(
7780
"Please set a valid [Galaxy Root](command:galaxyTools.planemo.openSettings)" +
78-
" for planemo in the [Settings](command:galaxytools.planemo.openSettings)."
81+
" for planemo in the [Settings](command:galaxytools.planemo.openSettings)."
7982
);
8083
}
8184

@@ -102,7 +105,7 @@ class GalaxyToolsPlanemoConfiguration implements IPlanemoConfiguration {
102105
}
103106

104107
class GalaxyToolsPlanemoTestingConfiguration implements IPlanemoTestingConfiguration {
105-
constructor(private readonly config: WorkspaceConfiguration) {}
108+
constructor(private readonly config: WorkspaceConfiguration) { }
106109

107110
enabled(): boolean {
108111
return this.config.get("planemo.testing.enabled", true);

client/src/configuration/workspaceConfiguration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export namespace Settings {
2424

2525
export interface IServerConfiguration {
2626
silentInstall(): boolean;
27+
setSilentInstall(value: boolean): void;
2728
}
2829

2930
export interface IWorkspaceConfiguration {

client/src/setup.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { commands, ExtensionContext, ProgressLocation, Uri, window, workspace }
55
import { LocalStorageService } from "./configuration/storage";
66
import { Constants } from "./constants";
77
import { execAsync, forceDeleteDirectory as removeDirectory } from "./utils";
8+
import { DefaultConfigurationFactory } from "./planemo/configuration";
89

910
/**
1011
* Ensures that the Language server is installed in the extension's virtual environment
@@ -39,7 +40,7 @@ export async function installLanguageServer(
3940
if (storedPython === null && !isSilentInstall) {
4041
const result = await window.showInformationMessage(
4142
`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}`,
42-
...["Install", "More Info"]
43+
...["Install", "More Info", "Don't ask again"]
4344
);
4445

4546
if (result === undefined) {
@@ -52,6 +53,10 @@ export async function installLanguageServer(
5253
"https://github.com/galaxyproject/galaxy-language-server/blob/main/client/README.md#installation"
5354
)
5455
);
56+
} else if (result === "Don't ask again") {
57+
// Set user preference to silent install
58+
const configFactory = new DefaultConfigurationFactory();
59+
configFactory.getConfiguration().server().setSilentInstall(true);
5560
}
5661
}
5762

0 commit comments

Comments
 (0)