fix stop commands
This commit is contained in:
Родитель
834a458a46
Коммит
775f4ccdd4
11
package.json
11
package.json
|
@ -1027,20 +1027,25 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"view/title": [
|
"view/title": [
|
||||||
|
{
|
||||||
|
"command": "cmake.projectStatus.stop",
|
||||||
|
"when": "view == cmake.projectStatus && cmake:isBuilding && cmake:enableFullFeatureSet",
|
||||||
|
"group": "navigation@1"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "cmake.projectStatus.update",
|
"command": "cmake.projectStatus.update",
|
||||||
"when": "view == cmake.projectStatus && cmake:enableFullFeatureSet",
|
"when": "view == cmake.projectStatus && cmake:enableFullFeatureSet",
|
||||||
"group": "navigation@1"
|
"group": "navigation@2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "cmake.projectStatus.debugTarget",
|
"command": "cmake.projectStatus.debugTarget",
|
||||||
"when": "view == cmake.projectStatus && !cmake:hideDebugCommand && cmake:enableFullFeatureSet",
|
"when": "view == cmake.projectStatus && !cmake:hideDebugCommand && cmake:enableFullFeatureSet",
|
||||||
"group": "navigation@2"
|
"group": "navigation@3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "cmake.projectStatus.launchTarget",
|
"command": "cmake.projectStatus.launchTarget",
|
||||||
"when": "view == cmake.projectStatus && !cmake:hideLaunchCommand && cmake:enableFullFeatureSet",
|
"when": "view == cmake.projectStatus && !cmake:hideLaunchCommand && cmake:enableFullFeatureSet",
|
||||||
"group": "navigation@2"
|
"group": "navigation@3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "cmake.outline.configureAll",
|
"command": "cmake.outline.configureAll",
|
||||||
|
|
|
@ -142,7 +142,7 @@ export function execute(command: string, args?: string[], outputConsumer?: Outpu
|
||||||
// and doesn't have to be 100% correct.
|
// and doesn't have to be 100% correct.
|
||||||
localize('executing.command', 'Executing command: {0}', cmdstr));
|
localize('executing.command', 'Executing command: {0}', cmdstr));
|
||||||
if (options.environment) {
|
if (options.environment) {
|
||||||
log.debug(localize('execution.environment', ' with environment: {0}', JSON.stringify(final_env)));
|
//log.debug(localize('execution.environment', ' with environment: {0}', JSON.stringify(final_env)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const spawn_opts: proc.SpawnOptions = {
|
const spawn_opts: proc.SpawnOptions = {
|
||||||
|
|
|
@ -72,9 +72,8 @@ class TreeDataProvider implements vscode.TreeDataProvider<Node>, vscode.Disposab
|
||||||
this.disposables.push(...[
|
this.disposables.push(...[
|
||||||
this.treeView,
|
this.treeView,
|
||||||
// Commands for projectStatus items
|
// Commands for projectStatus items
|
||||||
vscode.commands.registerCommand('cmake.projectStatus.stop', async (node: Node) => {
|
vscode.commands.registerCommand('cmake.projectStatus.stop', async () => {
|
||||||
await runCommand('stop');
|
runCommand('stop');
|
||||||
await this.refresh(node);
|
|
||||||
}),
|
}),
|
||||||
vscode.commands.registerCommand('cmake.projectStatus.selectKit', async (node: Node) => {
|
vscode.commands.registerCommand('cmake.projectStatus.selectKit', async (node: Node) => {
|
||||||
await runCommand('selectKit');
|
await runCommand('selectKit');
|
||||||
|
@ -84,23 +83,15 @@ class TreeDataProvider implements vscode.TreeDataProvider<Node>, vscode.Disposab
|
||||||
await runCommand('selectConfigurePreset', folder);
|
await runCommand('selectConfigurePreset', folder);
|
||||||
await this.refresh(node);
|
await this.refresh(node);
|
||||||
}),
|
}),
|
||||||
vscode.commands.registerCommand('cmake.projectStatus.configure', async (node: Node, folder: vscode.WorkspaceFolder) => {
|
vscode.commands.registerCommand('cmake.projectStatus.configure', async (folder: vscode.WorkspaceFolder) => {
|
||||||
node.changeToStop();
|
runCommand('configure', folder);
|
||||||
await this.refresh(node);
|
|
||||||
await runCommand('configure', folder);
|
|
||||||
node.changeBackToOriginal();
|
|
||||||
await this.refresh(node);
|
|
||||||
}),
|
}),
|
||||||
vscode.commands.registerCommand('cmake.projectStatus.setVariant', async (node: Node, folder: vscode.WorkspaceFolder, variant: Promise<string>) => {
|
vscode.commands.registerCommand('cmake.projectStatus.setVariant', async (node: Node, folder: vscode.WorkspaceFolder, variant: Promise<string>) => {
|
||||||
await runCommand('setVariant', folder, await variant);
|
await runCommand('setVariant', folder, await variant);
|
||||||
await this.refresh(node);
|
await this.refresh(node);
|
||||||
}),
|
}),
|
||||||
vscode.commands.registerCommand('cmake.projectStatus.build', async (node: Node, folder: vscode.WorkspaceFolder, target: Promise<string>) => {
|
vscode.commands.registerCommand('cmake.projectStatus.build', async (folder: vscode.WorkspaceFolder, target: Promise<string>) => {
|
||||||
node.changeToStop();
|
runCommand('build', folder, await target);
|
||||||
await this.refresh(node);
|
|
||||||
await runCommand('build', folder, await target);
|
|
||||||
node.changeBackToOriginal();
|
|
||||||
await this.refresh(node);
|
|
||||||
}),
|
}),
|
||||||
vscode.commands.registerCommand('cmake.projectStatus.setDefaultTarget', async (node: Node, folder: vscode.WorkspaceFolder, target: Promise<string>) => {
|
vscode.commands.registerCommand('cmake.projectStatus.setDefaultTarget', async (node: Node, folder: vscode.WorkspaceFolder, target: Promise<string>) => {
|
||||||
await runCommand('setDefaultTarget', folder, await target);
|
await runCommand('setDefaultTarget', folder, await target);
|
||||||
|
@ -182,10 +173,16 @@ class TreeDataProvider implements vscode.TreeDataProvider<Node>, vscode.Disposab
|
||||||
let nodes: Node[] = [];
|
let nodes: Node[] = [];
|
||||||
const configNode = new ConfigNode();
|
const configNode = new ConfigNode();
|
||||||
await configNode.initialize();
|
await configNode.initialize();
|
||||||
|
if (this.isBusy) {
|
||||||
|
configNode.convertToStopCommand();
|
||||||
|
}
|
||||||
nodes.push(configNode);
|
nodes.push(configNode);
|
||||||
if (!this.isBuildButtonHidden) {
|
if (!this.isBuildButtonHidden) {
|
||||||
const buildNode = new BuildNode();
|
const buildNode = new BuildNode();
|
||||||
await buildNode.initialize();
|
await buildNode.initialize();
|
||||||
|
if (this.isBusy) {
|
||||||
|
buildNode.convertToStopCommand();
|
||||||
|
}
|
||||||
nodes.push(buildNode);
|
nodes.push(buildNode);
|
||||||
}
|
}
|
||||||
const testNode = new TestNode();
|
const testNode = new TestNode();
|
||||||
|
@ -232,11 +229,6 @@ class TreeDataProvider implements vscode.TreeDataProvider<Node>, vscode.Disposab
|
||||||
setIsBusy(isBusy: boolean) {
|
setIsBusy(isBusy: boolean) {
|
||||||
if (this.isBusy != isBusy) {
|
if (this.isBusy != isBusy) {
|
||||||
this.isBusy = isBusy;
|
this.isBusy = isBusy;
|
||||||
if (isBusy) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,10 +255,10 @@ class Node extends vscode.TreeItem {
|
||||||
async refresh(): Promise<void> {
|
async refresh(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
changeToStop(): void {
|
convertToStopCommand(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
changeBackToOriginal(): void {
|
convertToOriginalCommand(): void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,7 +276,7 @@ class ConfigNode extends Node {
|
||||||
this.command = {
|
this.command = {
|
||||||
title: this.label,
|
title: this.label,
|
||||||
command: 'cmake.projectStatus.configure',
|
command: 'cmake.projectStatus.configure',
|
||||||
arguments: [this, treeDataProvider.cmakeProject.workspaceFolder]
|
arguments: [treeDataProvider.cmakeProject.workspaceFolder]
|
||||||
};
|
};
|
||||||
this.tooltip = this.label;
|
this.tooltip = this.label;
|
||||||
this.collapsibleState = vscode.TreeItemCollapsibleState.Expanded;
|
this.collapsibleState = vscode.TreeItemCollapsibleState.Expanded;
|
||||||
|
@ -318,7 +310,7 @@ class ConfigNode extends Node {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
changeToStop(): void {
|
convertToStopCommand(): void {
|
||||||
this.label = localize("configure.running", "Configure (Running)");
|
this.label = localize("configure.running", "Configure (Running)");
|
||||||
const title: string = localize('Stop', 'Stop');
|
const title: string = localize('Stop', 'Stop');
|
||||||
this.command = {
|
this.command = {
|
||||||
|
@ -330,7 +322,7 @@ class ConfigNode extends Node {
|
||||||
this.contextValue = "stop";
|
this.contextValue = "stop";
|
||||||
}
|
}
|
||||||
|
|
||||||
changeBackToOriginal(): Promise<void> {
|
convertToOriginalCommand(): Promise<void> {
|
||||||
return this.initialize();
|
return this.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +341,7 @@ class BuildNode extends Node {
|
||||||
this.command = {
|
this.command = {
|
||||||
title: this.label,
|
title: this.label,
|
||||||
command: 'cmake.projectStatus.build',
|
command: 'cmake.projectStatus.build',
|
||||||
arguments: [this, treeDataProvider.cmakeProject.workspaceFolder, treeDataProvider.cmakeProject.buildTargetName()]
|
arguments: [treeDataProvider.cmakeProject.workspaceFolder, treeDataProvider.cmakeProject.buildTargetName()]
|
||||||
};
|
};
|
||||||
this.tooltip = this.label;
|
this.tooltip = this.label;
|
||||||
this.collapsibleState = vscode.TreeItemCollapsibleState.Expanded;
|
this.collapsibleState = vscode.TreeItemCollapsibleState.Expanded;
|
||||||
|
@ -381,7 +373,7 @@ class BuildNode extends Node {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
changeToStop(): void {
|
convertToStopCommand(): void {
|
||||||
this.label = localize("build.running", "Build (Running)");
|
this.label = localize("build.running", "Build (Running)");
|
||||||
const title: string = localize('Stop', 'Stop');
|
const title: string = localize('Stop', 'Stop');
|
||||||
this.command = {
|
this.command = {
|
||||||
|
@ -393,7 +385,7 @@ class BuildNode extends Node {
|
||||||
this.contextValue = "stop";
|
this.contextValue = "stop";
|
||||||
}
|
}
|
||||||
|
|
||||||
changeBackToOriginal(): Promise<void> {
|
convertToOriginalCommand(): Promise<void> {
|
||||||
return this.initialize();
|
return this.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче