From: shane.xb.qian Date: Sun, 13 Mar 2022 04:10:38 +0000 (+0800) Subject: shane/mdf: adding ntfOnce func and make unsupported telemetry/event ntf only ntf... X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=7f9c6eb39ecde427da0a88e95f25f0d601e98fb6;p=vim-lsp.git shane/mdf: adding ntfOnce func and make unsupported telemetry/event ntf only ntf once --- 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