From 39861a4e15cf8cfed69f336c7178bb4b480fe3a3 Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 20 Dec 2018 12:05:41 +0000 Subject: Support tracing lsp requests. TODO: Debug why decorations are sent even when highlightingOn is disabled This makes the log volume so high its impossible to work with anyway --- editors/code/package.json | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'editors') diff --git a/editors/code/package.json b/editors/code/package.json index d53e44b21..2989a7016 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -131,6 +131,17 @@ "type": "boolean", "default": true, "description": "Highlight Rust code (overrides built-in syntax highlighting)" + }, + "ra-lsp.trace.server": { + "type": "string", + "scope": "window", + "enum": [ + "off", + "messages", + "verbose" + ], + "default": "off", + "description": "Trace requests to the ra-lsp server" } } }, -- cgit v1.2.3 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(-) (limited to 'editors') 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