Fix a few problems in the new side bar

This commit is contained in:
Bob Brown (DEVDIV) 2023-03-29 11:07:46 -07:00
Родитель 7ed1fb42f8
Коммит 5f7877b28e
1 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -392,6 +392,8 @@ class BuildNode extends Node {
} else { } else {
this.buildPreset = new BuildPreset(); this.buildPreset = new BuildPreset();
await this.buildPreset.initialize(); await this.buildPreset.initialize();
this.buildTarget = new BuildTarget();
await this.buildTarget.initialize();
} }
} }
@ -402,7 +404,7 @@ class BuildNode extends Node {
if (!treeDataProvider.cmakeProject.useCMakePresets) { if (!treeDataProvider.cmakeProject.useCMakePresets) {
return [this.buildTarget!]; return [this.buildTarget!];
} else { } else {
return [this.buildPreset!]; return [this.buildPreset!, this.buildTarget!];
} }
} }
@ -650,7 +652,7 @@ class BuildTarget extends Node {
return; return;
} }
const title: string = localize('set.build.target', 'Set Build Target'); const title: string = localize('set.build.target', 'Set Build Target');
this.label = await treeDataProvider.cmakeProject.buildTargetName() || await treeDataProvider.cmakeProject.allTargetName; this.label = await this.getLabel();
this.tooltip = title; this.tooltip = title;
this.collapsibleState = vscode.TreeItemCollapsibleState.None; this.collapsibleState = vscode.TreeItemCollapsibleState.None;
this.contextValue = 'buildTarget'; this.contextValue = 'buildTarget';
@ -660,7 +662,12 @@ class BuildTarget extends Node {
if (!treeDataProvider.cmakeProject) { if (!treeDataProvider.cmakeProject) {
return; return;
} }
this.label = await treeDataProvider.cmakeProject.buildTargetName() || await treeDataProvider.cmakeProject.allTargetName; this.label = await this.getLabel();
}
async getLabel(): Promise<string> {
const targetName = await treeDataProvider.cmakeProject!.buildTargetName();
return targetName || treeDataProvider.cmakeProject!.allTargetName;
} }
} }