Skip to content
Open
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 @@ -7,6 +7,7 @@ Features:
- Add support for `${workspaceFolder}`, `${workspaceFolder:name}` variables and relative paths in `cmake.exclude` setting for multi-root workspaces. [#4689](https://github.com/microsoft/vscode-cmake-tools/pull/4689)
- Add `onConfigureResult` event to the CMake Tools API that fires after every configure attempt (success or failure), allowing dependent extensions to detect and react to configure failures. [#4021](https://github.com/microsoft/vscode-cmake-tools/issues/4021)
- Add `cmake.preConfigureTask` setting to execute a named VS Code task before every CMake configure. [#2449](https://github.com/microsoft/vscode-cmake-tools/issues/2449) [#4960](https://github.com/microsoft/vscode-cmake-tools/pull/4960) [@erdemiru](https://github.com/erdemiru)
- Add experimental, opt-in `cmake.colorizedBuildOutput` setting to highlight build errors, warnings, and notes by severity using theme-aware ANSI colors, shown in a dedicated CMake Build integrated terminal where error locations are clickable. A `rich` mode additionally adds accessible severity glyphs, dimmed build-progress lines, a build header, and a colored build-summary footer. A `compiler` mode forwards the compiler's and build tools' own colors by setting `CMAKE_COLOR_DIAGNOSTICS=ON` at configure time and `CLICOLOR_FORCE=1` at build time. The colorization is portable: it is rendered in the terminal today and is automatically routed to the Output panel if a future VS Code renders ANSI there. The CMake Build terminal opens promptly when you start a build (even when a configure runs first) and honors `cmake.revealLogOnAutomaticTrigger`, staying quiet for automatic and programmatic builds (e.g. configure-on-open and builds invoked through the CMake Tools API by Copilot via the C/C++ DevTools companion) while always surfacing failures. [#478](https://github.com/microsoft/vscode-cmake-tools/issues/478)

Improvements:
- Reduce CI pipeline time by parallelizing E2E test jobs and adding build artifact caching.
Expand Down
3 changes: 3 additions & 0 deletions docs/cmake-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ Options that support substitution, in the table below, allow variable references
| `cmake.buildBeforeRun` | If `true`, build the launch/debug target before running the target. | `true` | no |
| `cmake.buildDirectory` | Specify the build directory (i.e. the root directory where `CMakeCache.txt` will be generated.) | `${workspaceFolder}/build` | yes |
| `cmake.buildEnvironment`| An object containing `key:value` pairs of environment variables, which will be passed only to the compiler. | `null` (no environment variables specified) | yes |
| `cmake.buildOutputGlyphs` | Glyph style for `cmake.colorizedBuildOutput: rich`. Use `ascii` if your terminal font does not render the Unicode severity glyphs (✗ ⚠ ℹ ✓). One of `unicode`, `ascii`. | `unicode` | no |
| `cmake.buildTask` | If `true`, generate VS Code tasks for building. | `false` | no |
| `cmake.buildToolArgs` | An array of additional arguments to pass to the underlying build tool. | `[]` (empty array-no additional arguments) | yes |
| `cmake.cacheInit` | Path, or list of paths, to cache-initialization files. Passed to CMake via the `-C` command-line argument. | `[]` (empty array-no cache initializer files) | no |
| `cmake.clearOutputBeforeBuild` | If `true`, clear output before building. | `true` | no |
| `cmake.cmakeCommunicationMode` | Specifies the protocol for communicating between the extension and CMake | `automatic` | no |
| `cmake.cmakePath`| Specify location of the cmake executable. | `cmake` (causes CMake Tools to search the `PATH` environment variable, as well as some hard-coded locations.) | Supports substitution for `workspaceRoot`, `workspaceFolder`, `workspaceRootFolderName`, `userHome`, `${command:...}` and `${env:...}`. Other substitutions result in an empty string. |
| `cmake.colorizedBuildOutput` | Experimental, opt-in: highlight build errors, warnings, and notes by severity using theme-aware ANSI colors, shown in a dedicated **CMake Build** integrated terminal (the VS Code Output panel cannot render ANSI colors). `rich` additionally adds severity glyphs, dimmed progress, a build header, and a colored summary footer. `compiler` forwards the compiler's and build tools' own colors via `CMAKE_COLOR_DIAGNOSTICS=ON` (configure time, requires a reconfigure) and `CLICOLOR_FORCE=1` (build time). One of `off`, `severity`, `rich`, `compiler`. | `off` | no |
| `cmake.configureArgs` | Arguments to CMake that will be passed during the configure process. Prefer to use `cmake.configureSettings` or [CMake variants](variants.md).</br> It is not recommended to pass `-D` arguments using this setting. | `[]` (empty array-no arguments) | yes |
| `cmake.configureEnvironment` | An object containing `key:value` pairs of environment variables, which will be passed to CMake only when configuring.| `null` (no environment variable pairs) | yes |
| `cmake.configureOnEdit` | Automatically configure CMake project directories when the path in the `cmake.sourceDirectory` setting is updated or when `CMakeLists.txt` or `*.cmake` files are saved. | `true` | no |
Expand Down Expand Up @@ -90,6 +92,7 @@ Options that support substitution, in the table below, allow variable references
| `cmake.preferredGenerators` | A list of strings of generator names to try, in order, when configuring a CMake project for the first time. | `[]` | no |
| `cmake.preRunCoverageTarget` | Target to build before running tests with coverage using the test explorer. | `null` | no |
| `cmake.revealLog` | Controls when the CMake output log should be revealed. Possible values: `focus` (show the log and move focus to the output channel), `always` (show the log but do not move focus), `never` (do not show the log), `error` (show the log only when an error occurs). | `always` | no |
| `cmake.revealLogOnAutomaticTrigger` | Whether automatic or programmatic CMake operations (configure-on-open, automatic reconfigure, and builds or tests invoked through the CMake Tools API, e.g. by Copilot via the C/C++ DevTools companion) reveal the CMake build output. Failures are always shown. | `false` | no |
| `cmake.saveBeforeBuild` | If `true` (the default), saves open text documents when build or configure is invoked before running CMake. | `true` | no |
| `cmake.setBuildTargetSameAsLaunchTarget` | If `true`, setting the launch/debug target automatically sets the build target to match. | `false` | no |
| `cmake.setBuildTypeOnMultiConfig` | If `true`, set build type on multi-config generators. | `false` | no |
Expand Down
38 changes: 38 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2425,6 +2425,38 @@
"description": "%cmake-tools.configuration.cmake.clearOutputBeforeBuild.description%",
"scope": "resource"
},
"cmake.colorizedBuildOutput": {
"type": "string",
"enum": [
"off",
"severity",
"rich",
"compiler"
],
"enumDescriptions": [
"%cmake-tools.configuration.cmake.colorizedBuildOutput.off.description%",
"%cmake-tools.configuration.cmake.colorizedBuildOutput.severity.description%",
"%cmake-tools.configuration.cmake.colorizedBuildOutput.rich.description%",
"%cmake-tools.configuration.cmake.colorizedBuildOutput.compiler.description%"
],
"default": "off",
"markdownDescription": "%cmake-tools.configuration.cmake.colorizedBuildOutput.markdownDescription%",
"scope": "resource"
},
"cmake.buildOutputGlyphs": {
"type": "string",
"enum": [
"unicode",
"ascii"
],
"enumDescriptions": [
"%cmake-tools.configuration.cmake.buildOutputGlyphs.unicode.description%",
"%cmake-tools.configuration.cmake.buildOutputGlyphs.ascii.description%"
],
"default": "unicode",
"markdownDescription": "%cmake-tools.configuration.cmake.buildOutputGlyphs.markdownDescription%",
"scope": "window"
},
"cmake.configureSettings": {
"type": "object",
"default": {},
Expand Down Expand Up @@ -4072,6 +4104,12 @@
],
"description": "%cmake-tools.configuration.cmake.revealLog.description%"
},
"cmake.revealLogOnAutomaticTrigger": {
"type": "boolean",
"default": false,
"markdownDescription": "%cmake-tools.configuration.cmake.revealLogOnAutomaticTrigger.markdownDescription%",
"scope": "window"
},
"cmake.exportCompileCommandsFile": {
"type": "boolean",
"default": true,
Expand Down
9 changes: 9 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@
"cmake-tools.configuration.cmake.saveBeforeBuild.description": "Save open files before building.",
"cmake-tools.configuration.cmake.buildBeforeRun.description": "Build the target before running it.",
"cmake-tools.configuration.cmake.clearOutputBeforeBuild.description": "Clear build output before each build.",
"cmake-tools.configuration.cmake.colorizedBuildOutput.markdownDescription": "Experimental, opt-in: highlight build errors, warnings, and notes by severity using theme-aware ANSI colors. Because the VS Code Output panel cannot render ANSI colors, colorized output is shown in a dedicated **CMake Build** integrated terminal (the regular CMake/Build Output channel is unchanged).",
"cmake-tools.configuration.cmake.colorizedBuildOutput.off.description": "Do not colorize build output.",
"cmake-tools.configuration.cmake.colorizedBuildOutput.severity.description": "Highlight build errors, warnings, and notes by severity, shown in a dedicated CMake Build integrated terminal.",
"cmake-tools.configuration.cmake.colorizedBuildOutput.rich.description": "Everything in 'severity', plus accessible severity glyphs, dimmed build-progress lines, a build header, and a colored build-summary footer (error/warning counts and elapsed time).",
"cmake-tools.configuration.cmake.colorizedBuildOutput.compiler.description": "Show the compiler's and build tools' own colors by setting CMAKE_COLOR_DIAGNOSTICS=ON at configure time and CLICOLOR_FORCE=1 at build time. Requires a reconfigure to take effect. Best with GCC/Clang and Ninja/Make; MSVC (cl.exe) emits no colors, so prefer 'severity' or 'rich' for MSVC.",
"cmake-tools.configuration.cmake.buildOutputGlyphs.markdownDescription": "Glyph style used by `cmake.colorizedBuildOutput: rich`. Use `ascii` if your terminal font does not render the Unicode severity glyphs (✗ ⚠ ℹ ✓).",
"cmake-tools.configuration.cmake.buildOutputGlyphs.unicode.description": "Use Unicode severity glyphs (✗ ⚠ ℹ ✓).",
"cmake-tools.configuration.cmake.buildOutputGlyphs.ascii.description": "Use ASCII severity markers (x ! i +) for fonts that do not render the Unicode glyphs.",
"cmake-tools.configuration.cmake.configureSettings.description": "CMake variables to set on the command line. This setting is specific to kits and will not be used for CMake Presets.",
"cmake-tools.configuration.cmake.cacheInit.string.description": "Path to a cache-initializing CMake file.",
"cmake-tools.configuration.cmake.cacheInit.array.description": "List of cache initializer files.",
Expand Down Expand Up @@ -364,6 +372,7 @@
"cmake-tools.configuration.cmake.revealLog.always.description": "The log appears but the output channel doesn't take the cursor focus.",
"cmake-tools.configuration.cmake.revealLog.never.description": "The log neither appears nor takes the focus.",
"cmake-tools.configuration.cmake.revealLog.onError.description": "The log appears only when the build or the configuration fails.",
"cmake-tools.configuration.cmake.revealLogOnAutomaticTrigger.markdownDescription": "When `true`, automatic and programmatic CMake operations - such as configure-on-open, automatic reconfigure, and builds or tests invoked by other extensions through the CMake Tools API (for example the C/C++ DevTools companion acting on behalf of Copilot) - reveal the CMake build output. When `false` (the default), these operations run quietly so they don't switch the panel away from a terminal you are using. The `#cmake.revealLog#` setting still controls how operations you start yourself reveal the log. Build, test, and configure failures are always shown, regardless of this setting.",
"cmake-tools.configuration.cmake.exportCompileCommandsFile.description": "Enables exporting compile_commands.json. This only is used in Kits scenarios. In Presets scenarios, please set this by using CMakePresets.json",
"cmake-tools.configuration.cmake.useCMakePresets.description": "Use CMakePresets.json to configure drive CMake configure, build, and test. When using CMakePresets.json, kits, variants, and some settings in settings.json will be ignored.",
"cmake-tools.configuration.cmake.useVsDeveloperEnvironment.description": "When using CMake Presets on Windows, use the Visual Studio environment as the parent environment. Selecting auto will only apply the Visual Studio environment when we detect a supported compiler (cl, clang, clang-cl, clang-cpp, clang++), or the Ninja generator is being used.",
Expand Down
6 changes: 3 additions & 3 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,17 @@ class CMakeProjectWrapper implements api.Project {

build(targets?: string[]): Promise<void> {
logApiTelemetry('build');
return withErrorCheck('build', () => this.project.build(targets));
return withErrorCheck('build', () => this.project.build(targets, undefined, undefined, undefined, true));
}

async buildWithResult(targets?: string[], cancellationToken?: vscode.CancellationToken): Promise<api.CommandResult> {
logApiTelemetry('buildWithResult');
return this.project.build(targets, undefined, undefined, cancellationToken);
return this.project.build(targets, undefined, undefined, cancellationToken, true);
}

async ctestWithResult(tests?: string[], cancellationToken?: vscode.CancellationToken): Promise<api.CommandResult> {
logApiTelemetry('ctestWithResult');
return this.project.ctest(undefined, new CTestOutputLogger(), tests, cancellationToken);
return this.project.ctest(undefined, new CTestOutputLogger(), tests, cancellationToken, true);
}

install(): Promise<void> {
Expand Down
Loading
Loading