Use corret Uri method and extract feature flag guard

This commit is contained in:
Nora
2023-06-22 15:24:37 +00:00
parent 2898acd67f
commit c0c42d36b9
2 changed files with 9 additions and 7 deletions

View File

@@ -27,9 +27,7 @@ export class QueriesModule extends DisposableObject {
}
public getCommands(): QueriesPanelCommands {
if (!isCanary() || !showQueriesPanel()) {
// Currently, we only want to expose the new panel when we are in development and canary mode
// and the developer has enabled the "Show queries panel" flag.
if (!this.shouldInitializeQueriesPanel) {
return {} as any as QueriesPanelCommands;
}
@@ -43,9 +41,7 @@ export class QueriesModule extends DisposableObject {
}
private initialize(app: App, cliServer: CodeQLCliServer): void {
if (!isCanary() || !showQueriesPanel()) {
// Currently, we only want to expose the new panel when we are in canary mode
// and the user has enabled the "Show queries panel" flag.
if (!this.shouldInitializeQueriesPanel) {
return;
}
void extLogger.log("Initializing queries panel.");
@@ -64,4 +60,10 @@ export class QueriesModule extends DisposableObject {
this.queriesPanel = new QueriesPanel(app, queryDiscovery);
this.push(this.queriesPanel);
}
private shouldInitializeQueriesPanel(): boolean {
// Currently, we only want to expose the new panel when we are in canary mode
// and the user has enabled the "Show queries panel" flag.
return isCanary() && showQueriesPanel();
}
}

View File

@@ -32,7 +32,7 @@ export class QueriesPanel extends DisposableObject {
): Promise<void> {
await this.app.queryServerCommands.execute(
"codeQLQueries.runLocalQueryFromQueriesPanel",
vscode.Uri.parse(queryTreeViewItem.path),
vscode.Uri.file(queryTreeViewItem.path),
);
}
}