Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impl3137 - SidePanel: Add buttons for project #3354

Merged
merged 10 commits into from
Oct 2, 2023
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Improvements:
- Updated debugging documentation to add the LLDB configuration needed for macOS. [PR #3332](https://github.com/microsoft/vscode-cmake-tools/pull/3332) [@slhck](https://github.com/slhck)
- In multi-root workspace, the Project Outline View now shows all configured projects. [PR #3270](https://github.com/microsoft/vscode-cmake-tools/pull/3270) [@vlavati](https://github.com/vlavati)
- Added script mode and ability to connect to externally launched CMake processes. [PR #3277](https://github.com/microsoft/vscode-cmake-tools/pull/3277)
- Added buttons to the project nodes in the Project Outline View. [PR #3354](https://github.com/microsoft/vscode-cmake-tools/pull/3354) [@vlavati](https://github.com/vlavati)

Bug Fixes:
- Fix Unhandled Exception if no args are specified in `cmake.getLaunchTargetFilename` inside an input context of a task. [PR #3348](https://github.com/microsoft/vscode-cmake-tools/issues/3348) [@vlavati](https://github.com/vlavati)
Expand Down
21 changes: 20 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,11 @@
{
"command": "cmake.outline.clean",
"when": "cmake:enableFullFeatureSet",
"title": "%cmake-tools.command.cmake.clean.title%"
"title": "%cmake-tools.command.cmake.clean.title%",
"icon": {
"dark": "res/dark/clean-icon.svg",
"light": "res/light/clean-icon.svg"
}
},
{
"command": "cmake.cleanAll",
Expand Down Expand Up @@ -1515,6 +1519,21 @@
"when": "cmake:enableFullFeatureSet && view == cmake.outline && viewItem =~ /nodeType=file/ && viewItem =~ /compilable=true/",
"group": "1_fileActions@7"
},
{
"command": "cmake.outline.configure",
"when": "view == cmake.outline && viewItem =~ /nodeType=project/",
"group": "inline@1"
},
{
"command": "cmake.outline.build",
"when": "cmake:enableFullFeatureSet && view == cmake.outline && viewItem =~ /nodeType=project/",
"group": "inline@2"
},
{
"command": "cmake.outline.clean",
"when": "cmake:enableFullFeatureSet && view == cmake.outline && viewItem =~ /nodeType=project/",
"group": "inline@3"
},
{
"command": "cmake.outline.compileFile",
"when": "cmake:enableFullFeatureSet && view == cmake.outline && viewItem =~ /nodeType=file/ && viewItem =~ /compilable=true/",
Expand Down
39 changes: 39 additions & 0 deletions res/dark/clean-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions res/light/clean-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 7 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import rollbar from '@cmt/rollbar';
import { StateManager } from './state';
import { cmakeTaskProvider, CMakeTaskProvider } from '@cmt/cmakeTaskProvider';
import * as telemetry from '@cmt/telemetry';
import { ProjectOutline, TargetNode, SourceFileNode, WorkspaceFolderNode } from '@cmt/projectOutline';
import { ProjectOutline, ProjectNode, TargetNode, SourceFileNode, WorkspaceFolderNode } from '@cmt/projectOutline';
import * as util from '@cmt/util';
import { ProgressHandle, DummyDisposable, reportProgress, runCommand } from '@cmt/util';
import { DEFAULT_VARIANTS } from '@cmt/variant';
Expand Down Expand Up @@ -1101,11 +1101,11 @@ export class ExtensionManager implements vscode.Disposable {
return this.runCMakeCommandForAll(cmakeProject => cmakeProject.cleanConfigureWithDebugger(ConfigureTrigger.commandCleanConfigureAllWithDebugger, debuggerInformation), undefined, true);
}

configure(folder?: vscode.WorkspaceFolder, showCommandOnly?: boolean) {
configure(folder?: vscode.WorkspaceFolder, showCommandOnly?: boolean, sourceDir?: string) {
telemetry.logEvent("configure", { all: "false", debug: "false"});
return this.runCMakeCommand(
cmakeProject => cmakeProject.configureInternal(ConfigureTrigger.commandConfigure, [], showCommandOnly ? ConfigureType.ShowCommandOnly : ConfigureType.Normal),
folder, undefined, true);
folder, undefined, true, sourceDir);
}

configureWithDebugger(folder?: vscode.WorkspaceFolder) {
Expand All @@ -1120,7 +1120,7 @@ export class ExtensionManager implements vscode.Disposable {
}

showConfigureCommand(folder?: vscode.WorkspaceFolder) {
return this.configure(folder, true);
return this.configure(folder, true, undefined);
}

configureAll() {
Expand Down Expand Up @@ -1876,6 +1876,9 @@ async function setup(context: vscode.ExtensionContext, progress?: ProgressHandle
vscode.commands.registerCommand('cmake.outline.editCacheUI', () => runCommand('editCacheUI')),
vscode.commands.registerCommand('cmake.outline.cleanRebuildAll', () => runCommand('cleanRebuildAll')),
// Commands for outline items
vscode.commands.registerCommand('cmake.outline.configure', (what: ProjectNode) => runCommand('configure', what.folder, false, what.sourceDirectory)),
vscode.commands.registerCommand('cmake.outline.build', (what: ProjectNode) => runCommand('build', what.folder, "all", what.sourceDirectory)),
vscode.commands.registerCommand('cmake.outline.clean', (what: ProjectNode) => runCommand('build', what.folder, "clean", what.sourceDirectory)),
vscode.commands.registerCommand('cmake.outline.buildTarget', (what: TargetNode) => runCommand('build', what.folder, what.name, what.sourceDir)),
vscode.commands.registerCommand('cmake.outline.runUtilityTarget', (what: TargetNode) => runCommand('build', what.folder, what.name, what.sourceDir)),
vscode.commands.registerCommand('cmake.outline.debugTarget', (what: TargetNode) => runCommand('debugTarget', what.folder, what.name, what.sourceDir)),
Expand Down
3 changes: 2 additions & 1 deletion src/projectOutline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ export class TargetNode extends BaseNode {
}
}

class ProjectNode extends BaseNode {
export class ProjectNode extends BaseNode {
constructor(readonly name: string, readonly folder: vscode.WorkspaceFolder, readonly sourceDirectory: string) {
// id: project_name:project_directory
super(`${name}:${sourceDirectory}`);
Expand All @@ -414,6 +414,7 @@ class ProjectNode extends BaseNode {
item.label += ` — (${localize('empty.project', 'Empty project')})`;
}
item.tooltip = `${this.name}\n${this.sourceDirectory}`;
item.contextValue = 'nodeType=project';
return item;
}

Expand Down
Loading