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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.11
Improvements:
- Fix build Error: EMFILE: too many open files. [#2288](https://github.com/microsoft/vscode-cmake-tools/issues/2288) [@FrogTheFrog](https://github.com/FrogTheFrog)
- Add commands to get preset names. [PR #2433](https://github.com/microsoft/vscode-cmake-tools/pull/2433)

Bug Fixes:
- `Clean All Projects` menu item builds rather than cleans. [#2460](https://github.com/microsoft/vscode-cmake-tools/issues/2460)
Expand Down
3 changes: 3 additions & 0 deletions docs/cmake-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ Supported commands for substitution:
|`cmake.tasksBuildCommand`|The CMake command used to build your project based on the currently selected Kit + Variant + Target. Suitable for use within `tasks.json`.|
|`cmake.activeFolderName`|The name of the active folder (e.g. in a multi-root workspace)|
|`cmake.activeFolderPath`|The asolute path of the active folder (e.g. in a multi-root workspace)|
|`cmake.activeConfigurePresetName`|The name of the active configure preset.|
|`cmake.activeBuildPresetName`|The name of the active build preset.|
|`cmake.activeTestPresetName`|The name of the active test preset.|

## Next steps

Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
"activationEvents": [
"onCommand:cmake.activeFolderName",
"onCommand:cmake.activeFolderPath",
"onCommand:cmake.activeConfigurePresetName",
"onCommand:cmake.activeBuildPresetName",
"onCommand:cmake.activeTestPresetName",
"onCommand:cmake.build",
"onCommand:cmake.buildAll",
"onCommand:cmake.buildWithTarget",
Expand Down
18 changes: 18 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,21 @@ class ExtensionManager implements vscode.Disposable {
return false;
}

activeConfigurePresetName(): string {
telemetry.logEvent("substitution", { command: "activeConfigurePresetName" });
return this.folders.activeFolder?.cmakeTools.configurePreset?.name || '';
}

activeBuildPresetName(): string {
telemetry.logEvent("substitution", { command: "activeBuildPresetName" });
return this.folders.activeFolder?.cmakeTools.buildPreset?.name || '';
}

activeTestPresetName(): string {
telemetry.logEvent("substitution", { command: "activeTestPresetName" });
return this.folders.activeFolder?.cmakeTools.testPreset?.name || '';
}

/**
* Opens CMakePresets.json at the root of the project. Creates one if it does not exist.
*/
Expand Down Expand Up @@ -1629,6 +1644,9 @@ async function setup(context: vscode.ExtensionContext, progress?: ProgressHandle
const funs: (keyof ExtensionManager)[] = [
'activeFolderName',
'activeFolderPath',
'activeConfigurePresetName',
'activeBuildPresetName',
'activeTestPresetName',
"useCMakePresets",
"openCMakePresets",
'addConfigurePreset',
Expand Down