mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-26 11:55:04 +00:00
Add a very hacky workaround to not trace decorations requests
This commit is contained in:
parent
a0e8538129
commit
ecab036d6f
1 changed files with 25 additions and 1 deletions
|
@ -22,7 +22,7 @@ export class Server {
|
||||||
const clientOptions: lc.LanguageClientOptions = {
|
const clientOptions: lc.LanguageClientOptions = {
|
||||||
documentSelector: [{ scheme: 'file', language: 'rust' }],
|
documentSelector: [{ scheme: 'file', language: 'rust' }],
|
||||||
initializationOptions: {
|
initializationOptions: {
|
||||||
publishDecorations: true,
|
publishDecorations: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,6 +32,30 @@ export class Server {
|
||||||
serverOptions,
|
serverOptions,
|
||||||
clientOptions
|
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(() => {
|
Server.client.onReady().then(() => {
|
||||||
for (const [type, handler] of notificationHandlers) {
|
for (const [type, handler] of notificationHandlers) {
|
||||||
Server.client.onNotification(type, handler);
|
Server.client.onNotification(type, handler);
|
||||||
|
|
Loading…
Reference in a new issue