Skip to content
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
2 changes: 2 additions & 0 deletions packages/amazonq/src/lsp/lspInstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller<
ui: path.join(assetDirectory, 'clients/amazonq-ui.js'),
}
}

protected override downloadMessageOverride: string | undefined = 'Updating Amazon Q plugin'
}
9 changes: 8 additions & 1 deletion packages/core/src/shared/lsp/baseLspInstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export abstract class BaseLspInstaller<T extends ResourcePaths = ResourcePaths,
id,
new Range(supportedVersions, {
includePrerelease: true,
})
}),
this.downloadMessageOverride
).resolve()

const assetDirectory = installationResult.assetDirectory
Expand Down Expand Up @@ -75,6 +76,12 @@ export abstract class BaseLspInstaller<T extends ResourcePaths = ResourcePaths,
return r
}

/**
* Allows implementations of this class to set a custom message to show users
* when the artifacts are being downloaded. If not set, a default message will be shown.
*/
protected downloadMessageOverride: string | undefined = undefined

protected abstract postInstall(assetDirectory: string): Promise<void>
protected abstract resourcePaths(assetDirectory?: string): T
}
12 changes: 10 additions & 2 deletions packages/core/src/shared/lsp/lspResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,20 @@ import vscode from 'vscode'
const remoteDownloadTimeout = oneMinute * 30

export class LanguageServerResolver {
private readonly downloadMessage: string

constructor(
private readonly manifest: Manifest,
private readonly lsName: string,
private readonly versionRange: semver.Range,
/**
* Custom message to show user when downloading, if undefined it will use the default.
*/
downloadMessage?: string,
private readonly _defaultDownloadFolder?: string
) {}
) {
this.downloadMessage = downloadMessage ?? `Updating '${this.lsName}' language server`
}

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