From 7f9c6eb39ecde427da0a88e95f25f0d601e98fb6 Mon Sep 17 00:00:00 2001 From: "shane.xb.qian" Date: Sun, 13 Mar 2022 12:10:38 +0800 Subject: [PATCH] shane/mdf: adding ntfOnce func and make unsupported telemetry/event ntf only ntf once --- autoload/lsp/handlers.vim | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/autoload/lsp/handlers.vim b/autoload/lsp/handlers.vim index 3ad2adb..ec37783 100644 --- a/autoload/lsp/handlers.vim +++ b/autoload/lsp/handlers.vim @@ -799,6 +799,16 @@ def ProcessUnsupportedNotif(lspserver: dict, reply: dict) util.ErrMsg('Error: Unsupported notification message received from the LSP server (' .. lspserver.path .. '), message = ' .. reply->string()) enddef +# per-filetype private map inside to record if ntf once or not +var ftypeNtfOnceMap: dict = {} +# process unsupported notification messages but only notify once +def ProcessUnsupportedNotifOnce(lspserver: dict, reply: dict) + if !ftypeNtfOnceMap->get(&ft, v:false) + ProcessUnsupportedNotif(lspserver, reply) + ftypeNtfOnceMap->extend({[&ft]: v:true}) + endif +enddef + # ignore unsupported notification message def IgnoreNotif(lspserver: dict, reply: dict) enddef @@ -811,7 +821,7 @@ export def ProcessNotif(lspserver: dict, reply: dict): void 'window/logMessage': ProcessLogMsgNotif, 'textDocument/publishDiagnostics': ProcessDiagNotif, '$/progress': ProcessUnsupportedNotif, - 'telemetry/event': ProcessUnsupportedNotif, + 'telemetry/event': ProcessUnsupportedNotifOnce, # Java language server sends the 'language/status' notification which is # not in the LSP specification 'language/status': IgnoreNotif -- 2.50.0