mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 01:25:36 -05:00
Change target platform of project (#12639)
* Add quick pick to select target platform for a project * add test * show current target platform and info message for new target platform * fix test failing
This commit is contained in:
@@ -515,6 +515,24 @@ export class ProjectsController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the project's DSP to the selected target platform
|
||||
* @param context a treeItem in a project's hierarchy, to be used to obtain a Project
|
||||
*/
|
||||
public async changeTargetPlatform(context: Project | BaseProjectTreeItem): Promise<void> {
|
||||
const project = this.getProjectFromContext(context);
|
||||
const selectedTargetPlatform = (await vscode.window.showQuickPick((Array.from(constants.targetPlatformToVersion.keys())).map(version => { return { label: version }; }),
|
||||
{
|
||||
canPickMany: false,
|
||||
placeHolder: constants.selectTargetPlatform(constants.getTargetPlatformFromVersion(project.getProjectTargetVersion()))
|
||||
}))?.label;
|
||||
|
||||
if (selectedTargetPlatform) {
|
||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(selectedTargetPlatform)!);
|
||||
vscode.window.showInformationMessage(constants.currentTargetPlatform(project.projectFileName, constants.getTargetPlatformFromVersion(project.getProjectTargetVersion())));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a database reference to the project
|
||||
* @param context a treeItem in a project's hierarchy, to be used to obtain a Project
|
||||
@@ -592,7 +610,7 @@ export class ProjectsController {
|
||||
}
|
||||
}
|
||||
|
||||
private getProjectFromContext(context: Project | BaseProjectTreeItem | WorkspaceTreeItem) {
|
||||
private getProjectFromContext(context: Project | BaseProjectTreeItem | WorkspaceTreeItem): Project {
|
||||
if ('element' in context) {
|
||||
return context.element.project;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user