Merge pull request #2459 from github/robertbrignull/discovery-logging
Avoid vscode reference rfom discovery.ts
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { DisposableObject } from "../pure/disposable-object";
|
||||
import { extLogger } from "./logging/vscode/loggers";
|
||||
import { getErrorMessage } from "../pure/helpers-pure";
|
||||
import { Logger } from "./logging";
|
||||
|
||||
/**
|
||||
* Base class for "discovery" operations, which scan the file system to find specific kinds of
|
||||
@@ -11,7 +11,7 @@ export abstract class Discovery<T> extends DisposableObject {
|
||||
private restartWhenFinished = false;
|
||||
private currentDiscoveryPromise: Promise<void> | undefined;
|
||||
|
||||
constructor(private readonly name: string) {
|
||||
constructor(private readonly name: string, private readonly logger: Logger) {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ export abstract class Discovery<T> extends DisposableObject {
|
||||
try {
|
||||
results = await this.discover();
|
||||
} catch (err) {
|
||||
void extLogger.log(
|
||||
void this.logger.log(
|
||||
`${this.name} failed. Reason: ${getErrorMessage(err)}`,
|
||||
);
|
||||
results = undefined;
|
||||
|
||||
@@ -8,6 +8,7 @@ import { FileTreeDirectory, FileTreeLeaf } from "../common/file-tree-nodes";
|
||||
import { getOnDiskWorkspaceFoldersObjects } from "../helpers";
|
||||
import { AppEventEmitter } from "../common/events";
|
||||
import { QueryDiscoverer } from "./query-tree-data-provider";
|
||||
import { extLogger } from "../common";
|
||||
|
||||
/**
|
||||
* The results of discovering queries.
|
||||
@@ -41,7 +42,7 @@ export class QueryDiscovery
|
||||
);
|
||||
|
||||
constructor(app: App, private readonly cliServer: CodeQLCliServer) {
|
||||
super("Query Discovery");
|
||||
super("Query Discovery", extLogger);
|
||||
|
||||
this.onDidChangeQueriesEmitter = this.push(app.createEventEmitter<void>());
|
||||
this.push(app.onDidChangeWorkspaceFolders(this.refresh.bind(this)));
|
||||
|
||||
@@ -11,6 +11,7 @@ import { MultiFileSystemWatcher } from "../common/vscode/multi-file-system-watch
|
||||
import { CodeQLCliServer } from "../codeql-cli/cli";
|
||||
import { pathExists } from "fs-extra";
|
||||
import { FileTreeDirectory, FileTreeLeaf } from "../common/file-tree-nodes";
|
||||
import { extLogger } from "../common";
|
||||
|
||||
/**
|
||||
* The results of discovering QL tests.
|
||||
@@ -42,7 +43,7 @@ export class QLTestDiscovery extends Discovery<QLTestDiscoveryResults> {
|
||||
private readonly workspaceFolder: WorkspaceFolder,
|
||||
private readonly cliServer: CodeQLCliServer,
|
||||
) {
|
||||
super("QL Test Discovery");
|
||||
super("QL Test Discovery", extLogger);
|
||||
|
||||
this.push(this.watcher.onDidChange(this.handleDidChange, this));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user