Remove popups and update defaults for `configureOnOpen` (#3967)
* update defaults and remove popups * update changelog * fix types for configureOnOpen * fix eslint
This commit is contained in:
Родитель
c848ee3705
Коммит
a4ff8d1716
|
@ -13,6 +13,7 @@ Improvements:
|
|||
- Resolve diagnostics files relative to workspace and build directory, fixes [#1401](https://github.com/microsoft/vscode-cmake-tools/issues/1401) [@fargies](https://github.com/fargies)
|
||||
- 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)
|
||||
- Preset expansion occurs on `CMakePresets.json` or `CMakeUserPresets.json` save, and if there are no errors the expanded presets are cached. The VS Developer Environment will only be applied to a preset if it is selected. Expansion errors will show in the problems panel and preset files with errors will be invalid, and any presets they contain cannot be used. [#3905](https://github.com/microsoft/vscode-cmake-tools/pull/3905)
|
||||
- Remove pop-ups asking to configure, default `cmake.configureOnOpen` to `true`. [#3967](https://github.com/microsoft/vscode-cmake-tools/pull/3967)
|
||||
|
||||
Bug Fixes:
|
||||
|
||||
|
|
|
@ -2576,7 +2576,7 @@
|
|||
},
|
||||
"cmake.configureOnOpen": {
|
||||
"type": "boolean",
|
||||
"default": null,
|
||||
"default": true,
|
||||
"description": "%cmake-tools.configuration.cmake.configureOnOpen.description%",
|
||||
"scope": "resource",
|
||||
"tags": [
|
||||
|
|
|
@ -116,7 +116,7 @@ export interface DiagnosticsConfiguration {
|
|||
export interface DiagnosticsSettings {
|
||||
communicationMode: CMakeCommunicationMode;
|
||||
useCMakePresets: UseCMakePresets;
|
||||
configureOnOpen: boolean | null;
|
||||
configureOnOpen: boolean;
|
||||
}
|
||||
|
||||
export interface ConfigureCancelInformation {
|
||||
|
@ -3314,7 +3314,7 @@ export class CMakeProject {
|
|||
return {
|
||||
communicationMode: 'automatic',
|
||||
useCMakePresets: 'auto',
|
||||
configureOnOpen: null
|
||||
configureOnOpen: true
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ export interface ExtensionConfigurationSettings {
|
|||
mergedCompileCommands: string | null;
|
||||
copyCompileCommands: string | null;
|
||||
loadCompileCommands: boolean;
|
||||
configureOnOpen: boolean | null;
|
||||
configureOnOpen: boolean;
|
||||
configureOnEdit: boolean;
|
||||
deleteBuildDirOnCleanConfigure: boolean;
|
||||
skipConfigureIfCachePresent: boolean | null;
|
||||
|
@ -430,7 +430,7 @@ export class ConfigurationReader implements vscode.Disposable {
|
|||
return this.configData.cpackArgs;
|
||||
}
|
||||
get configureOnOpen() {
|
||||
if (util.isCodespaces() && this.configData.configureOnOpen === null) {
|
||||
if (this.configData.configureOnOpen === null) {
|
||||
return true;
|
||||
}
|
||||
return this.configData.configureOnOpen;
|
||||
|
@ -602,7 +602,7 @@ export class ConfigurationReader implements vscode.Disposable {
|
|||
mergedCompileCommands: new vscode.EventEmitter<string | null>(),
|
||||
copyCompileCommands: new vscode.EventEmitter<string | null>(),
|
||||
loadCompileCommands: new vscode.EventEmitter<boolean>(),
|
||||
configureOnOpen: new vscode.EventEmitter<boolean | null>(),
|
||||
configureOnOpen: new vscode.EventEmitter<boolean>(),
|
||||
configureOnEdit: new vscode.EventEmitter<boolean>(),
|
||||
deleteBuildDirOnCleanConfigure: new vscode.EventEmitter<boolean>(),
|
||||
skipConfigureIfCachePresent: new vscode.EventEmitter<boolean | null>(),
|
||||
|
|
|
@ -127,7 +127,7 @@ export class CMakeFileApiDriver extends CMakeDriver {
|
|||
if (cacheExists && this.generator?.name === await this.getGeneratorFromCache(this.cachePath)) {
|
||||
await this.loadGeneratorInformationFromCache(this.cachePath);
|
||||
const code_model_exist = await this.updateCodeModel();
|
||||
if (!code_model_exist && this.config.configureOnOpen === true) {
|
||||
if (!code_model_exist && this.config.configureOnOpen) {
|
||||
await this.doConfigure([], undefined, undefined);
|
||||
}
|
||||
} else {
|
||||
|
@ -136,7 +136,7 @@ export class CMakeFileApiDriver extends CMakeDriver {
|
|||
// Since this setting will prevent configure anyway (until a configure command is invoked
|
||||
// or build/test will trigger automatic configuring), there is no need to delete the cache now
|
||||
// even if this is not a project configured from outside VSCode.
|
||||
if (cacheExists && this.config.configureOnOpen !== false) {
|
||||
if (cacheExists && this.config.configureOnOpen) {
|
||||
// No need to remove the other CMake files for the generator change to work properly
|
||||
log.info(localize('removing', 'Removing {0}', this.cachePath));
|
||||
try {
|
||||
|
|
|
@ -594,62 +594,15 @@ export class ExtensionManager implements vscode.Disposable {
|
|||
vscode.workspace.workspaceFolders[0] === rootFolder &&
|
||||
await scanForKitsIfNeeded(project);
|
||||
|
||||
let shouldConfigure = project?.workspaceContext.config.configureOnOpen;
|
||||
const shouldConfigure = project?.workspaceContext.config.configureOnOpen;
|
||||
|
||||
const hascmakelists = await util.globForFileName("CMakeLists.txt", 3, project.folderPath);
|
||||
if (shouldConfigure === null && !util.isTestMode() && hascmakelists) {
|
||||
interface Choice1 {
|
||||
title: string;
|
||||
doConfigure: boolean;
|
||||
}
|
||||
const chosen = await vscode.window.showInformationMessage<Choice1>(
|
||||
localize('configure.this.project', 'Would you like to configure project {0}?', `"${rootFolder.name}"`),
|
||||
{},
|
||||
{ title: localize('yes.button', 'Yes'), doConfigure: true },
|
||||
{ title: localize('not.now.button', 'Not now'), doConfigure: false }
|
||||
);
|
||||
if (!chosen) {
|
||||
// User cancelled.
|
||||
shouldConfigure = null;
|
||||
} else {
|
||||
const persistMessage = chosen.doConfigure ?
|
||||
localize('always.configure.on.open', 'Always configure projects upon opening?') :
|
||||
localize('never.configure.on.open', 'Configure projects on opening?');
|
||||
const buttonMessages = chosen.doConfigure ?
|
||||
[localize('yes.button', 'Yes'), localize('no.button', 'No')] :
|
||||
[localize('never.button', 'Never'), localize('never.for.this.workspace.button', 'Not this workspace')];
|
||||
interface Choice2 {
|
||||
title: string;
|
||||
persistMode: 'user' | 'workspace';
|
||||
}
|
||||
// Try to persist the user's selection to a `settings.json`
|
||||
const prompt = vscode.window.showInformationMessage<Choice2>(
|
||||
persistMessage,
|
||||
{},
|
||||
{ title: buttonMessages[0], persistMode: 'user' },
|
||||
{ title: buttonMessages[1], persistMode: 'workspace' })
|
||||
.then(async choice => {
|
||||
if (!choice) {
|
||||
// Use cancelled. Do nothing.
|
||||
return;
|
||||
}
|
||||
const config = vscode.workspace.getConfiguration(undefined, rootFolder.uri);
|
||||
let configTarget = vscode.ConfigurationTarget.Global;
|
||||
if (choice.persistMode === 'workspace') {
|
||||
configTarget = vscode.ConfigurationTarget.WorkspaceFolder;
|
||||
}
|
||||
await config.update('cmake.configureOnOpen', chosen.doConfigure, configTarget);
|
||||
});
|
||||
rollbar.takePromise(localize('persist.config.on.open.setting', 'Persist config-on-open setting'), {}, prompt);
|
||||
shouldConfigure = chosen.doConfigure;
|
||||
}
|
||||
}
|
||||
if (!project.hasCMakeLists()) {
|
||||
if (shouldConfigure === true && hascmakelists) {
|
||||
if (shouldConfigure && hascmakelists) {
|
||||
await project.cmakePreConditionProblemHandler(CMakePreconditionProblems.MissingCMakeListsFile, false, this.workspaceConfig);
|
||||
}
|
||||
} else {
|
||||
if (shouldConfigure === true) {
|
||||
if (shouldConfigure) {
|
||||
// We've opened a new workspace folder, and the user wants us to
|
||||
// configure it now.
|
||||
log.debug(localize('configuring.workspace.on.open', 'Configuring workspace on open {0}', project.folderPath));
|
||||
|
|
|
@ -47,7 +47,7 @@ function createConfig(conf: Partial<ExtensionConfigurationSettings>): Configurat
|
|||
mergedCompileCommands: null,
|
||||
copyCompileCommands: null,
|
||||
loadCompileCommands: true,
|
||||
configureOnOpen: null,
|
||||
configureOnOpen: true,
|
||||
configureOnEdit: true,
|
||||
deleteBuildDirOnCleanConfigure: false,
|
||||
skipConfigureIfCachePresent: null,
|
||||
|
|
Загрузка…
Ссылка в новой задаче