src/goLanguageServer: use a separate channel for LSP trace
The output channel will be named 'gopls (trace)'.
The separation allows the copy&pasted LSP trace is parseable by the standard LSP inspector,
and the important log messages or crash logs from the server is in the less chatty gopls
output channel.
Change-Id: I997554cb99008d15c13293e0ec92d174a5de6cf1
Change-Id: I997554cb99008d15c13293e0ec92d174a5de6cf1
GitHub-Last-Rev: 7cfd94ef335352b4d473647fd8c6c296b72572e0
GitHub-Pull-Request: golang/vscode-go#39
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/233598
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/src/goLanguageServer.ts b/src/goLanguageServer.ts
index 6818e34..ec374fd 100644
--- a/src/goLanguageServer.ts
+++ b/src/goLanguageServer.ts
@@ -63,6 +63,7 @@
let languageServerDisposable: vscode.Disposable;
let latestConfig: LanguageServerConfig;
let serverOutputChannel: vscode.OutputChannel;
+let serverTraceChannel: vscode.OutputChannel;
// defaultLanguageProviders is the list of providers currently registered.
let defaultLanguageProviders: vscode.Disposable[] = [];
@@ -161,8 +162,13 @@
async function buildLanguageClient(config: LanguageServerConfig): Promise<LanguageClient> {
// Reuse the same output channel for each instance of the server.
- if (config.enabled && !serverOutputChannel) {
- serverOutputChannel = vscode.window.createOutputChannel(config.serverName);
+ if (config.enabled) {
+ if (!serverOutputChannel) {
+ serverOutputChannel = vscode.window.createOutputChannel(config.serverName + ' (server)');
+ }
+ if (!serverTraceChannel) {
+ serverTraceChannel = vscode.window.createOutputChannel(config.serverName);
+ }
}
const c = new LanguageClient(
'go', // id
@@ -182,6 +188,7 @@
protocol2Code: (uri: string) => vscode.Uri.parse(uri)
},
outputChannel: serverOutputChannel,
+ traceOutputChannel: serverTraceChannel,
revealOutputChannelOn: RevealOutputChannelOn.Never,
initializationFailedHandler: (error: WebRequest.ResponseError<InitializeError>): boolean => {
vscode.window.showErrorMessage(
@@ -494,7 +501,7 @@
// If the user's version does not contain a timestamp,
// default to a semver comparison of the two versions.
- const usersVersionSemver = semver.coerce(usersVersion, {includePrerelease: true, loose: true});
+ const usersVersionSemver = semver.coerce(usersVersion, { includePrerelease: true, loose: true });
return semver.lt(usersVersionSemver, latestVersion) ? latestVersion : null;
}