Skip to content

Commit c0c42d3

Browse files
committed
Use corret Uri method and extract feature flag guard
1 parent 2898acd commit c0c42d3

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

extensions/ql-vscode/src/queries-panel/queries-module.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ export class QueriesModule extends DisposableObject {
2727
}
2828

2929
public getCommands(): QueriesPanelCommands {
30-
if (!isCanary() || !showQueriesPanel()) {
31-
// Currently, we only want to expose the new panel when we are in development and canary mode
32-
// and the developer has enabled the "Show queries panel" flag.
30+
if (!this.shouldInitializeQueriesPanel) {
3331
return {} as any as QueriesPanelCommands;
3432
}
3533

@@ -43,9 +41,7 @@ export class QueriesModule extends DisposableObject {
4341
}
4442

4543
private initialize(app: App, cliServer: CodeQLCliServer): void {
46-
if (!isCanary() || !showQueriesPanel()) {
47-
// Currently, we only want to expose the new panel when we are in canary mode
48-
// and the user has enabled the "Show queries panel" flag.
44+
if (!this.shouldInitializeQueriesPanel) {
4945
return;
5046
}
5147
void extLogger.log("Initializing queries panel.");
@@ -64,4 +60,10 @@ export class QueriesModule extends DisposableObject {
6460
this.queriesPanel = new QueriesPanel(app, queryDiscovery);
6561
this.push(this.queriesPanel);
6662
}
63+
64+
private shouldInitializeQueriesPanel(): boolean {
65+
// Currently, we only want to expose the new panel when we are in canary mode
66+
// and the user has enabled the "Show queries panel" flag.
67+
return isCanary() && showQueriesPanel();
68+
}
6769
}

extensions/ql-vscode/src/queries-panel/queries-panel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class QueriesPanel extends DisposableObject {
3232
): Promise<void> {
3333
await this.app.queryServerCommands.execute(
3434
"codeQLQueries.runLocalQueryFromQueriesPanel",
35-
vscode.Uri.parse(queryTreeViewItem.path),
35+
vscode.Uri.file(queryTreeViewItem.path),
3636
);
3737
}
3838
}

0 commit comments

Comments
 (0)