Pass in app.environment instead of vscode.env

This commit is contained in:
Robert
2023-06-05 13:27:17 +01:00
parent 1d80cbb496
commit 0e65c79c92

View File

@@ -1,7 +1,7 @@
import { dirname, basename, normalize, relative } from "path"; import { dirname, basename, normalize, relative } from "path";
import { Discovery } from "../common/discovery"; import { Discovery } from "../common/discovery";
import { CodeQLCliServer } from "../codeql-cli/cli"; import { CodeQLCliServer } from "../codeql-cli/cli";
import { Event, RelativePattern, Uri, WorkspaceFolder, env } from "vscode"; import { Event, RelativePattern, Uri, WorkspaceFolder } from "vscode";
import { MultiFileSystemWatcher } from "../common/vscode/multi-file-system-watcher"; import { MultiFileSystemWatcher } from "../common/vscode/multi-file-system-watcher";
import { App } from "../common/app"; import { App } from "../common/app";
import { FileTreeDirectory, FileTreeLeaf } from "../common/file-tree-nodes"; import { FileTreeDirectory, FileTreeLeaf } from "../common/file-tree-nodes";
@@ -41,7 +41,10 @@ export class QueryDiscovery
new MultiFileSystemWatcher(), new MultiFileSystemWatcher(),
); );
constructor(app: App, private readonly cliServer: CodeQLCliServer) { constructor(
private readonly app: App,
private readonly cliServer: CodeQLCliServer,
) {
super("Query Discovery", extLogger); super("Query Discovery", extLogger);
this.onDidChangeQueriesEmitter = this.push(app.createEventEmitter<void>()); this.onDidChangeQueriesEmitter = this.push(app.createEventEmitter<void>());
@@ -124,7 +127,11 @@ export class QueryDiscovery
return undefined; return undefined;
} }
const rootDirectory = new FileTreeDirectory<string>(fullPath, name, env); const rootDirectory = new FileTreeDirectory<string>(
fullPath,
name,
this.app.environment,
);
for (const queryPath of resolvedQueries) { for (const queryPath of resolvedQueries) {
const relativePath = normalize(relative(fullPath, queryPath)); const relativePath = normalize(relative(fullPath, queryPath));
const dirName = dirname(relativePath); const dirName = dirname(relativePath);