From ecab036d6ffcb85c45a288b312d79141bcd86fd9 Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Mon, 24 Dec 2018 13:43:08 +0000 Subject: Add a very hacky workaround to not trace decorations requests --- editors/code/src/server.ts | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/editors/code/src/server.ts b/editors/code/src/server.ts index 75e273f37..75bdf3207 100644 --- a/editors/code/src/server.ts +++ b/editors/code/src/server.ts @@ -22,7 +22,7 @@ export class Server { const clientOptions: lc.LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'rust' }], initializationOptions: { - publishDecorations: true, + publishDecorations: true } }; @@ -32,6 +32,30 @@ export class Server { serverOptions, clientOptions ); + // HACK: This is an awful way of filtering out the decorations notifications + // However, pending proper support, this is the most effecitve approach + // Proper support for this would entail a change to vscode-languageclient to allow not notifying on certain messages + // Or the ability to disable the serverside component of highlighting (but this means that to do tracing we need to disable hihlighting) + // This also requires considering our settings strategy, which is work which needs doing + // @ts-ignore The tracer is private to vscode-languageclient, but we need access to it to not log publishDecorations requests + Server.client._tracer = { + log: (messageOrDataObject: string | any, data?: string) => { + if (typeof messageOrDataObject === 'string') { + if ( + messageOrDataObject.includes('m/publishDecorations') || + messageOrDataObject.includes('m/decorationsRequest') + ) { + // Don't log publish decorations requests + } else { + // @ts-ignore This is just a utility function + Server.client.logTrace(messageOrDataObject, data); + } + } else { + // @ts-ignore + Server.client.logObjectTrace(messageOrDataObject); + } + } + }; Server.client.onReady().then(() => { for (const [type, handler] of notificationHandlers) { Server.client.onNotification(type, handler); -- cgit v1.2.3