Skip to content

Commit 2c894d3

Browse files
refactor(amazonq): Change Q LSP downloading message text
They want it to be slightly different, but the base lsp installer class has a generic message. SOLUTION: Allow an override message to be given from a specific LspResolver implementation. This override message will show when the download is happening. Everyone is happy. Signed-off-by: nkomonen-amazon <[email protected]>
1 parent 2f103ff commit 2c894d3

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

packages/amazonq/src/lsp/lspInstaller.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,6 @@ export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller<
4040
ui: path.join(assetDirectory, 'clients/amazonq-ui.js'),
4141
}
4242
}
43+
44+
protected override downloadMessageOverride: string | undefined = 'Updating Amazon Q plugin'
4345
}

packages/core/src/shared/lsp/baseLspInstaller.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ export abstract class BaseLspInstaller<T extends ResourcePaths = ResourcePaths,
4444
id,
4545
new Range(supportedVersions, {
4646
includePrerelease: true,
47-
})
47+
}),
48+
this.downloadMessageOverride
4849
).resolve()
4950

5051
const assetDirectory = installationResult.assetDirectory
@@ -75,6 +76,12 @@ export abstract class BaseLspInstaller<T extends ResourcePaths = ResourcePaths,
7576
return r
7677
}
7778

79+
/**
80+
* Allows implementations of this class to set a custom message to show users
81+
* when the artifacts are being downloaded. If not set, a default message will be shown.
82+
*/
83+
protected downloadMessageOverride: string | undefined = undefined
84+
7885
protected abstract postInstall(assetDirectory: string): Promise<void>
7986
protected abstract resourcePaths(assetDirectory?: string): T
8087
}

packages/core/src/shared/lsp/lspResolver.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,20 @@ import vscode from 'vscode'
2323
const remoteDownloadTimeout = oneMinute * 30
2424

2525
export class LanguageServerResolver {
26+
private readonly downloadMessage: string
27+
2628
constructor(
2729
private readonly manifest: Manifest,
2830
private readonly lsName: string,
2931
private readonly versionRange: semver.Range,
32+
/**
33+
* Custom message to show user when downloading, if undefined it will use the default.
34+
*/
35+
downloadMessage?: string,
3036
private readonly _defaultDownloadFolder?: string
31-
) {}
37+
) {
38+
this.downloadMessage = downloadMessage ?? `Updating '${this.lsName}' language server`
39+
}
3240

3341
/**
3442
* Downloads and sets up the Language Server, attempting different locations in order:
@@ -109,7 +117,7 @@ export class LanguageServerResolver {
109117
const timeout = new Timeout(remoteDownloadTimeout)
110118
void showProgressWithTimeout(
111119
{
112-
title: `Downloading '${this.lsName}' language server`,
120+
title: this.downloadMessage,
113121
location: vscode.ProgressLocation.Notification,
114122
cancellable: false,
115123
},

0 commit comments

Comments
 (0)