* implement #2521 by adding output channel argument * fix failed configuration not showing output channel on "on error" * implement review, add changelog * fix changelog --------- Co-authored-by: Garrett Campbell <86264750+gcampbell-msft@users.noreply.github.com> Co-authored-by: Garrett Campbell <gcampbell@microsoft.com>
This commit is contained in:
Родитель
eb4c00df1b
Коммит
890fb569a1
|
@ -10,6 +10,7 @@ Improvements:
|
|||
|
||||
- Add `Unspecified` option for selecting a kit variant to allow CMake itself to select the build type. [#3821](https://github.com/microsoft/vscode-cmake-tools/issues/3821)
|
||||
- Skip loading variants when using CMakePresets. [#3300](https://github.com/microsoft/vscode-cmake-tools/issues/3300)
|
||||
- Add setting to only show the cmake log on target failure. [#3785](https://github.com/microsoft/vscode-cmake-tools/pull/3785) [@stepeos](https://github.com/stepeos)
|
||||
|
||||
Bug Fixes:
|
||||
|
||||
|
|
|
@ -3484,12 +3484,14 @@
|
|||
"enum": [
|
||||
"focus",
|
||||
"always",
|
||||
"never"
|
||||
"never",
|
||||
"error"
|
||||
],
|
||||
"enumDescriptions": [
|
||||
"%cmake-tools.configuration.cmake.revealLog.focus.description%",
|
||||
"%cmake-tools.configuration.cmake.revealLog.always.description%",
|
||||
"%cmake-tools.configuration.cmake.revealLog.never.description%"
|
||||
"%cmake-tools.configuration.cmake.revealLog.never.description%",
|
||||
"%cmake-tools.configuration.cmake.revealLog.onError.description%"
|
||||
],
|
||||
"description": "%cmake-tools.configuration.cmake.revealLog.description%"
|
||||
},
|
||||
|
|
|
@ -257,6 +257,7 @@
|
|||
"cmake-tools.configuration.cmake.revealLog.focus.description": "The log appears and the output channel takes the cursor focus.",
|
||||
"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.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.",
|
||||
|
|
|
@ -1544,6 +1544,8 @@ export class CMakeProject {
|
|||
const result: ConfigureResult = await drv.configure(trigger, []);
|
||||
if (result.result === 0) {
|
||||
await this.refreshCompileDatabase(drv.expansionOptions);
|
||||
} else {
|
||||
log.showChannel(true);
|
||||
}
|
||||
await this.cTestController.refreshTests(drv);
|
||||
this.onReconfiguredEmitter.fire();
|
||||
|
@ -1555,7 +1557,7 @@ export class CMakeProject {
|
|||
return { result: -1, resultType: ConfigureResultType.NoCache };
|
||||
}
|
||||
|
||||
return vscode.window.withProgress(
|
||||
const res = await vscode.window.withProgress(
|
||||
{
|
||||
location: vscode.ProgressLocation.Window,
|
||||
title: localize('configuring.project', 'Configuring project'),
|
||||
|
@ -1633,6 +1635,7 @@ export class CMakeProject {
|
|||
await enableFullFeatureSet(true);
|
||||
await this.refreshCompileDatabase(drv.expansionOptions);
|
||||
} else if (result.result !== 0 && (await this.getCMakeExecutable()).isDebuggerSupported && cmakeConfiguration.get(showDebuggerConfigurationString) && !forciblyCanceled && result.resultType === ConfigureResultType.NormalOperation) {
|
||||
log.showChannel(true);
|
||||
const yesButtonTitle: string = localize(
|
||||
"yes.configureWithDebugger.button",
|
||||
"Debug"
|
||||
|
@ -1682,6 +1685,11 @@ export class CMakeProject {
|
|||
}
|
||||
}
|
||||
);
|
||||
// check if the an error occured during the configuration
|
||||
if (res.result !== 0) {
|
||||
log.showChannel(true);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1979,6 +1987,9 @@ export class CMakeProject {
|
|||
buildLogger.info(localize('starting.build', 'Starting build'));
|
||||
await setContextAndStore(isBuildingKey, true);
|
||||
rc = await drv!.build(newTargets, taskConsumer, isBuildCommand);
|
||||
if (rc !== 0) {
|
||||
log.showChannel(true); // in case build has failed
|
||||
}
|
||||
await setContextAndStore(isBuildingKey, false);
|
||||
if (rc === null) {
|
||||
buildLogger.info(localize('build.was.terminated', 'Build was terminated'));
|
||||
|
@ -2009,6 +2020,9 @@ export class CMakeProject {
|
|||
await setContextAndStore(isBuildingKey, true);
|
||||
const rc = await drv!.build(newTargets, consumer, isBuildCommand);
|
||||
await setContextAndStore(isBuildingKey, false);
|
||||
if (rc !== 0) {
|
||||
log.showChannel(true); // in case build has failed
|
||||
}
|
||||
if (rc === null) {
|
||||
buildLogger.info(localize('build.was.terminated', 'Build was terminated'));
|
||||
} else {
|
||||
|
|
|
@ -23,7 +23,7 @@ enum LogLevel {
|
|||
Fatal,
|
||||
}
|
||||
|
||||
type RevealLogKey = 'always' | 'never' | 'focus';
|
||||
type RevealLogKey = 'always' | 'never' | 'focus' | 'error';
|
||||
|
||||
/**
|
||||
* Get the name of a logging level
|
||||
|
@ -252,10 +252,17 @@ export class Logger {
|
|||
SingletonLogger.instance().clearOutputChannel();
|
||||
}
|
||||
|
||||
showChannel() {
|
||||
showChannel(error_to_show?: boolean) {
|
||||
const reveal_log = vscode.workspace.getConfiguration('cmake').get<RevealLogKey>('revealLog', 'always');
|
||||
|
||||
const should_show = (reveal_log !== 'never');
|
||||
let should_show: boolean = false;
|
||||
if (reveal_log === 'always') {
|
||||
should_show = true;
|
||||
}
|
||||
// won't show if no target information
|
||||
if (reveal_log === 'error' && error_to_show !== undefined) {
|
||||
should_show = error_to_show;
|
||||
}
|
||||
const should_focus = (reveal_log === 'focus');
|
||||
|
||||
if (should_show) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче