Skip to content

Commit

Permalink
add don't show again option (#3735)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcampbell-msft authored May 1, 2024
1 parent e0232f1 commit 13b2092
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Improvements:
- Add the ability to pin CMake Commands to the sidebar [#2984](https://github.com/microsoft/vscode-cmake-tools/issues/2984) & [#3296](https://github.com/microsoft/vscode-cmake-tools/issues/3296)
- Add support for variable expansion in `debugConfig.environment` [#3711](https://github.com/microsoft/vscode-cmake-tools/issues/3711)
- Add the ability to debug install targets [#532](https://github.com/microsoft/vscode-cmake-tools/issues/532)
- Add a "Don't Show Again" option in the select CMakeLists.txt.

Bug Fixes:

Expand Down
10 changes: 7 additions & 3 deletions src/cmakeProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -885,11 +885,13 @@ export class CMakeProject {
fullPath: file
})) : [];
const browse: string = localize("browse.for.cmakelists", "[Browse for CMakeLists.txt]");
items.push({ label: browse, fullPath: "", description: "Search for CMakeLists.txt on this computer" });
const dontAskAgain: string = localize("do.not.ask.again", "[Don't Show Again]");
items.push({ label: browse, fullPath: "", description: localize("search.for.cmakelists", "Search for CMakeLists.txt on this computer") });
items.push({ label: dontAskAgain, fullPath: "", description: localize("do.not.ask.again.description", "Do not ask for CMakeLists.txt again in this folder. This will enable the cmake.ignoreCMakeListsMissing setting.") });
const selection: FileItem | undefined = await vscode.window.showQuickPick(items, {
placeHolder: (items.length === 1 ? localize("cmakelists.not.found", "No CMakeLists.txt was found.") : localize("select.cmakelists", "Select CMakeLists.txt"))
});
telemetryProperties["missingCMakeListsUserAction"] = (selection === undefined) ? "cancel" : (selection.label === browse) ? "browse" : "pick";
telemetryProperties["missingCMakeListsUserAction"] = (selection === undefined) ? "cancel" : (selection.label === browse) ? "browse" : (selection.label === dontAskAgain) ? "dontAskAgain" : "pick";
let selectedFile: string | undefined;
if (!selection) {
break; // User canceled it.
Expand All @@ -905,6 +907,8 @@ export class CMakeProject {
// Keep the absolute path for CMakeLists.txt files that are located outside of the workspace folder.
selectedFile = cmakeListsFile[0].fsPath;
}
} else if (selection.label === dontAskAgain) {
await vscode.workspace.getConfiguration('cmake', this.workspaceFolder).update('ignoreCMakeListsMissing', true, vscode.ConfigurationTarget.WorkspaceFolder);
} else {
// Keep the relative path for CMakeLists.txt files that are located inside of the workspace folder.
// selection.label is the relative path to the selected CMakeLists.txt.
Expand Down Expand Up @@ -1611,7 +1615,7 @@ export class CMakeProject {
"yes.configureWithDebugger.button",
"Debug"
);
const doNotShowAgainTitle = localize('options.configureWithDebuggerOnFail.do.not.show', 'Do Not Show Again');
const doNotShowAgainTitle = localize('options.configureWithDebuggerOnFail.do.not.show', "Don't Show Again");
void vscode.window.showErrorMessage<MessageItem>(
localize('configure.failed.tryWithDebugger', 'Configure failed. Would you like to attempt to configure with the CMake Debugger?'),
{title: yesButtonTitle},
Expand Down
4 changes: 0 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,6 @@ export class ExtensionManager implements vscode.Disposable {
}

configure(folder?: vscode.WorkspaceFolder, showCommandOnly?: boolean, sourceDir?: string) {
telemetry.logEvent("configure", { all: "false", debug: "false"});
return this.runCMakeCommand(
async cmakeProject => (await cmakeProject.configureInternal(ConfigureTrigger.commandConfigure, [], showCommandOnly ? ConfigureType.ShowCommandOnly : ConfigureType.Normal)).result,
folder, undefined, true, sourceDir);
Expand All @@ -1310,7 +1309,6 @@ export class ExtensionManager implements vscode.Disposable {
}

configureWithDebuggerInternal(debuggerInformation: DebuggerInformation, folder?: vscode.WorkspaceFolder, showCommandOnly?: boolean, sourceDir?: string, trigger?: ConfigureTrigger) {
telemetry.logEvent("configure", { all: "false", debug: "true"});
return this.runCMakeCommand(
async cmakeProject => (await cmakeProject.configureInternal(trigger ?? ConfigureTrigger.commandConfigureWithDebugger, [], showCommandOnly ? ConfigureType.ShowCommandOnly : ConfigureType.NormalWithDebugger, debuggerInformation)).result,
folder, undefined, true, sourceDir);
Expand All @@ -1321,7 +1319,6 @@ export class ExtensionManager implements vscode.Disposable {
}

configureAll() {
telemetry.logEvent("configure", { all: "true", debug: "false"});
return this.runCMakeCommandForAll(async cmakeProject => ((await cmakeProject.configureInternal(ConfigureTrigger.commandCleanConfigureAll, [], ConfigureType.Normal)).result), undefined, true);
}

Expand All @@ -1331,7 +1328,6 @@ export class ExtensionManager implements vscode.Disposable {

configureAllWithDebuggerInternal(debuggerInformation: DebuggerInformation, trigger?: ConfigureTrigger) {
// I need to add ConfigureTriggers that account for coming from the project status view or project outline.
telemetry.logEvent("configure", { all: "true", debug: "true"});
return this.runCMakeCommandForAll(async cmakeProject => (await cmakeProject.configureInternal(trigger ?? ConfigureTrigger.commandConfigureAllWithDebugger, [], ConfigureType.NormalWithDebugger, debuggerInformation)).result, undefined, true);
}

Expand Down

0 comments on commit 13b2092

Please sign in to comment.