autoload/lsp/handlers.vim | 12 +++++++++++- diff --git a/autoload/lsp/handlers.vim b/autoload/lsp/handlers.vim index 3ad2adb05c53038206691df9d1e7c6ee47ddbdb5..ec37783477e38da893e088bcb5628865d35b434e 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 @@ 'window/showMessage': ProcessShowMsgNotif, '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