Skip to content

Commit f3e75d2

Browse files
committed
Better ability to filter statements
Signed-off-by: worksofliam <[email protected]>
1 parent b52271c commit f3e75d2

File tree

3 files changed

+45
-7
lines changed

3 files changed

+45
-7
lines changed

package.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@
310310
"id": "queryHistory",
311311
"name": "Statement History",
312312
"visibility": "visible",
313-
"when": "code-for-ibmi:connected == true"
313+
"when": "code-for-ibmi:connected == true && vscode-db2i:jobManager"
314314
},
315315
{
316316
"id": "jobManager",
@@ -581,6 +581,12 @@
581581
"category": "Db2 for i",
582582
"icon": "$(trash)"
583583
},
584+
{
585+
"command": "vscode-db2i.queryHistory.find",
586+
"title": "Search query history",
587+
"category": "Db2 for i",
588+
"icon": "$(search)"
589+
},
584590
{
585591
"command": "vscode-db2i.openSqlDocument",
586592
"title": "Open SQL Document",
@@ -860,6 +866,10 @@
860866
"command": "vscode-db2i.queryHistory.remove",
861867
"when": "never"
862868
},
869+
{
870+
"command": "vscode-db2i.queryHistory.find",
871+
"when": "never"
872+
},
863873
{
864874
"command": "vscode-db2i.jobManager.closeJob",
865875
"when": "never"
@@ -973,6 +983,11 @@
973983
"group": "navigation",
974984
"when": "view == queryHistory"
975985
},
986+
{
987+
"command": "vscode-db2i.queryHistory.find",
988+
"group": "navigation",
989+
"when": "view == queryHistory"
990+
},
976991
{
977992
"command": "vscode-db2i.jobManager.newJob",
978993
"group": "navigation@1",

src/views/queryHistoryView/contributes.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"id": "queryHistory",
77
"name": "Statement History",
88
"visibility": "visible",
9-
"when": "code-for-ibmi:connected == true"
9+
"when": "code-for-ibmi:connected == true && vscode-db2i:jobManager"
1010
}
1111
]
1212
},
@@ -28,20 +28,35 @@
2828
"title": "Clear statement history",
2929
"category": "Db2 for i",
3030
"icon": "$(trash)"
31+
},
32+
{
33+
"command": "vscode-db2i.queryHistory.find",
34+
"title": "Search query history",
35+
"category": "Db2 for i",
36+
"icon": "$(search)"
3137
}
3238
],
3339
"menus": {
3440
"commandPalette": [
3541
{
3642
"command": "vscode-db2i.queryHistory.remove",
3743
"when": "never"
44+
},
45+
{
46+
"command": "vscode-db2i.queryHistory.find",
47+
"when": "never"
3848
}
3949
],
4050
"view/title": [
4151
{
4252
"command": "vscode-db2i.queryHistory.clear",
4353
"group": "navigation",
4454
"when": "view == queryHistory"
55+
},
56+
{
57+
"command": "vscode-db2i.queryHistory.find",
58+
"group": "navigation",
59+
"when": "view == queryHistory"
4560
}
4661
],
4762
"view/item/context": [

src/views/queryHistoryView/index.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export class queryHistory implements TreeDataProvider<any> {
1818
window.showTextDocument(doc);
1919
});
2020
}),
21+
commands.registerCommand(`vscode-db2i.queryHistory.find`, async () => {
22+
commands.executeCommand('queryHistory.focus');
23+
commands.executeCommand('list.find');
24+
}),
2125

2226
commands.registerCommand(`vscode-db2i.queryHistory.prepend`, async (newQuery?: string) => {
2327
if (newQuery && Config.ready) {
@@ -61,10 +65,14 @@ export class queryHistory implements TreeDataProvider<any> {
6165
}),
6266

6367
commands.registerCommand(`vscode-db2i.queryHistory.clear`, async () => {
64-
if (Config.ready) {
65-
await Config.setPastQueries([]);
66-
this.refresh();
67-
}
68+
window.showInformationMessage(`Statement history`, {detail: `Are you sure you want to clear your statement history?`, modal: true}, `Clear`).then(async (result) => {
69+
if (result) {
70+
if (Config.ready) {
71+
await Config.setPastQueries([]);
72+
this.refresh();
73+
}
74+
}
75+
});
6876
}),
6977
)
7078
}
@@ -151,7 +159,7 @@ class TimePeriodNode extends TreeItem {
151159

152160
class PastQueryNode extends TreeItem {
153161
constructor(public query: string) {
154-
super(query.length > 63 ? query.substring(0, 60) + `...` : query);
162+
super(query);
155163

156164
this.contextValue = `query`;
157165

0 commit comments

Comments
 (0)