Use corret Uri method and extract feature flag guard
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user