Skip to content

Commit b17251b

Browse files
Convert handleRenameItem to call createSingleSelectionCommand
1 parent d29c24d commit b17251b

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

extensions/ql-vscode/src/query-history/query-history-manager.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,10 @@ export class QueryHistoryManager extends DisposableObject {
247247
createMultiSelectionCommand(this.handleRemoveHistoryItem.bind(this)),
248248
"codeQLQueryHistory.removeHistoryItemContextInline":
249249
createMultiSelectionCommand(this.handleRemoveHistoryItem.bind(this)),
250-
"codeQLQueryHistory.renameItem": this.handleRenameItem.bind(this),
250+
"codeQLQueryHistory.renameItem": createSingleSelectionCommand(
251+
this.handleRenameItem.bind(this),
252+
"query",
253+
),
251254
"codeQLQueryHistory.compareWith": this.handleCompareWith.bind(this),
252255
"codeQLQueryHistory.showEvalLog": this.handleShowEvalLog.bind(this),
253256
"codeQLQueryHistory.showEvalLogSummary":
@@ -543,25 +546,18 @@ export class QueryHistoryManager extends DisposableObject {
543546
}
544547
}
545548

546-
async handleRenameItem(
547-
singleItem: QueryHistoryInfo,
548-
multiSelect: QueryHistoryInfo[] | undefined,
549-
): Promise<void> {
550-
if (!this.assertSingleQuery(multiSelect)) {
551-
return;
552-
}
553-
549+
async handleRenameItem(item: QueryHistoryInfo): Promise<void> {
554550
const response = await window.showInputBox({
555551
placeHolder: `(use default: ${this.queryHistoryConfigListener.format})`,
556-
value: singleItem.userSpecifiedLabel ?? "",
552+
value: item.userSpecifiedLabel ?? "",
557553
title: "Set query label",
558554
prompt:
559555
"Set the query history item label. See the description of the codeQL.queryHistory.format setting for more information.",
560556
});
561557
// undefined response means the user cancelled the dialog; don't change anything
562558
if (response !== undefined) {
563559
// Interpret empty string response as 'go back to using default'
564-
singleItem.userSpecifiedLabel = response === "" ? undefined : response;
560+
item.userSpecifiedLabel = response === "" ? undefined : response;
565561
await this.refreshTreeView();
566562
}
567563
}

0 commit comments

Comments
 (0)