Skip to content

Commit da1bf73

Browse files
Upgrade the LSP client library for better logging support
10.0.0-next.15 brings full support for LogOutputChannels which cleans up the logging of severities and timestamps. Otherwise we end up with confusing duplicate severities being listed with duplicate timetsamps.
1 parent 1facaac commit da1bf73

File tree

8 files changed

+70
-68
lines changed

8 files changed

+70
-68
lines changed

package-lock.json

+52-56
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@
117117
"tmp": "0.0.33",
118118
"uuid": "^9.0.0",
119119
"vscode-html-languageservice": "^5.3.1",
120-
"vscode-jsonrpc": "9.0.0-next.7",
121-
"vscode-languageclient": "10.0.0-next.14",
120+
"vscode-jsonrpc": "9.0.0-next.8",
121+
"vscode-languageclient": "10.0.0-next.15",
122122
"vscode-languageserver-protocol": "3.17.6-next.12",
123123
"vscode-languageserver-textdocument": "1.0.12",
124124
"vscode-languageserver-types": "3.17.6-next.6",

src/lsptoolshost/activate.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { RazorLogger } from '../razor/src/razorLogger';
3333
import { registerRazorEndpoints } from './razor/razorEndpoints';
3434

3535
let _channel: vscode.LogOutputChannel;
36-
let _traceChannel: vscode.OutputChannel;
36+
let _traceChannel: vscode.LogOutputChannel;
3737

3838
/**
3939
* Creates and activates the Roslyn language server.
@@ -51,8 +51,7 @@ export async function activateRoslynLanguageServer(
5151
// Create a channel for outputting general logs from the language server.
5252
_channel = outputChannel;
5353
// Create a separate channel for outputting trace logs - these are incredibly verbose and make other logs very difficult to see.
54-
// The trace channel verbosity is controlled by the _channel verbosity.
55-
_traceChannel = vscode.window.createOutputChannel(vscode.l10n.t('C# LSP Trace Logs'));
54+
_traceChannel = vscode.window.createOutputChannel(vscode.l10n.t('C# LSP Trace Logs'), { log: true });
5655

5756
reporter.sendTelemetryEvent(TelemetryEventNames.ClientInitialize);
5857

src/lsptoolshost/server/roslynLanguageServer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ export class RoslynLanguageServer {
260260
additionalExtensionPaths: string[],
261261
languageServerEvents: RoslynLanguageServerEvents,
262262
channel: vscode.LogOutputChannel,
263-
traceChannel: vscode.OutputChannel
263+
traceChannel: vscode.LogOutputChannel
264264
): Promise<RoslynLanguageServer> {
265265
const devKit = getCSharpDevKit();
266266
if (devKit) {

src/omnisharp/engines/lspEngine.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import * as ObservableEvents from '../omnisharpLoggingEvents';
1313
import { EventStream } from '../../eventStream';
1414
import CompositeDisposable from '../../compositeDisposable';
1515
import Disposable from '../../disposable';
16-
import { ExtensionContext, CancellationTokenSource, OutputChannel, Location, CodeLens, Uri } from 'vscode';
16+
import { ExtensionContext, CancellationTokenSource, LogOutputChannel, Location, CodeLens, Uri } from 'vscode';
1717
import { LanguageMiddlewareFeature } from '../languageMiddlewareFeature';
1818
import { Events, OmniSharpServer } from '../server';
1919
import { IEngine } from './IEngine';
@@ -42,7 +42,7 @@ export class LspEngine implements IEngine {
4242
private eventBus: EventEmitter,
4343
private eventStream: EventStream,
4444
private context: ExtensionContext,
45-
private outputChannel: OutputChannel,
45+
private outputChannel: LogOutputChannel,
4646
private disposables: CompositeDisposable,
4747
private languageMiddlewareFeature: LanguageMiddlewareFeature,
4848
private platformInfo: PlatformInformation,

src/omnisharp/omnisharpLanguageServer.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,13 @@ export async function activateOmniSharpLanguageServer(
8989
eventStream.subscribe(dotnetTestChannelObserver.post);
9090
eventStream.subscribe(dotnetTestLoggerObserver.post);
9191

92-
const omnisharpChannel = vscode.window.createOutputChannel(vscode.l10n.t('OmniSharp Log'));
92+
// If we're in LSP mode, we can create a LogOutputChannel since that's what the LSP client now supports.
93+
// If we're not in LSP mode, we'll create a regular OutputChannel since the log formatting expects to be able to write
94+
// it's own formatted outputs which gets mixed up with LogOutputChannels.s
95+
const omnisharpChannel = omnisharpOptions.enableLspDriver
96+
? vscode.window.createOutputChannel(vscode.l10n.t('OmniSharp Log'), { log: true })
97+
: vscode.window.createOutputChannel(vscode.l10n.t('OmniSharp Log'));
98+
9399
const omnisharpLogObserver = new OmnisharpLoggerObserver(omnisharpChannel, platformInfo);
94100
const omnisharpChannelObserver = new OmnisharpChannelObserver(omnisharpChannel);
95101
eventStream.subscribe(omnisharpLogObserver.post);

src/omnisharp/server.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { Subject } from 'rxjs';
2121
import { debounceTime } from 'rxjs/operators';
2222
import CompositeDisposable from '../compositeDisposable';
2323
import Disposable from '../disposable';
24-
import { ExtensionContext, OutputChannel } from 'vscode';
24+
import { ExtensionContext, LogOutputChannel, OutputChannel } from 'vscode';
2525
import { LanguageMiddlewareFeature } from './languageMiddlewareFeature';
2626
import { LspEngine } from './engines/lspEngine';
2727
import { IEngine } from './engines/IEngine';
@@ -314,7 +314,8 @@ export class OmniSharpServer {
314314
this._eventBus,
315315
this.eventStream,
316316
this.context,
317-
this.outputChannel,
317+
// If we are in LSP mode, then we created an LogOutputChannel originally
318+
this.outputChannel as LogOutputChannel,
318319
disposables,
319320
this.languageMiddlewareFeature,
320321
this.platformInfo,

src/razor/src/razorLanguageServerOptions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as vscode from 'vscode';
77

88
export interface RazorLanguageServerOptions {
99
serverPath: string;
10-
outputChannel?: vscode.OutputChannel;
10+
outputChannel?: vscode.LogOutputChannel;
1111
debug?: boolean;
1212
usingOmniSharp: boolean;
1313
forceRuntimeCodeGeneration: boolean;

0 commit comments

Comments
 (0)