src/context: add govulncheckOutputChannel
that will be used by the language server middleware to relay
the progress report and result of gopls's govulncheck execution.
Change-Id: Ia0ec33b88697ec397f4217d9aea5d29e78fe1b4f
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/454135
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
diff --git a/src/context.ts b/src/context.ts
index 27f5ff4..e5562cf 100644
--- a/src/context.ts
+++ b/src/context.ts
@@ -16,14 +16,16 @@
languageClient?: LanguageClient;
legacyLanguageService?: LegacyLanguageService;
latestConfig?: LanguageServerConfig;
- serverOutputChannel?: vscode.OutputChannel;
+ serverOutputChannel?: vscode.OutputChannel; // server-side output.
+ serverTraceChannel?: vscode.OutputChannel; // client-side tracing.
+ govulncheckOutputChannel?: vscode.OutputChannel; // govulncheck output.
+
languageServerIsRunning?: boolean;
// serverInfo is the information from the server received during initialization.
serverInfo?: ServerInfo;
// lastUserAction is the time of the last user-triggered change.
// A user-triggered change is a didOpen, didChange, didSave, or didClose event.
lastUserAction?: Date;
- serverTraceChannel?: vscode.OutputChannel;
crashCount?: number;
// Some metrics for automated issue reports:
restartHistory?: Restart[];
diff --git a/src/goVulncheck.ts b/src/goVulncheck.ts
index 87f0665..f8fa23d 100644
--- a/src/goVulncheck.ts
+++ b/src/goVulncheck.ts
@@ -193,7 +193,7 @@
export class VulncheckProvider {
static scheme = 'govulncheck';
static setup({ subscriptions }: vscode.ExtensionContext, goCtx: GoExtensionContext) {
- const channel = vscode.window.createOutputChannel('govulncheck');
+ const channel = goCtx.govulncheckOutputChannel || vscode.window.createOutputChannel('govulncheck');
const instance = new this(channel);
subscriptions.push(
vscode.commands.registerCommand('go.vulncheck.run', async () => {
diff --git a/src/language/goLanguageServer.ts b/src/language/goLanguageServer.ts
index 69f389f..70baba5 100644
--- a/src/language/goLanguageServer.ts
+++ b/src/language/goLanguageServer.ts
@@ -333,6 +333,9 @@
if (!goCtx.serverTraceChannel) {
goCtx.serverTraceChannel = vscode.window.createOutputChannel(cfg.serverName);
}
+ if (!goCtx.govulncheckOutputChannel) {
+ goCtx.govulncheckOutputChannel = vscode.window.createOutputChannel('govulncheck');
+ }
}
return Object.assign(
{