]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
shane/mdf: adding ntfOnce func and make unsupported telemetry/event ntf only ntf...
authorshane.xb.qian <shane.qian@foxmail.com>
Sun, 13 Mar 2022 04:10:38 +0000 (12:10 +0800)
committershane.xb.qian <shane.qian@foxmail.com>
Sun, 13 Mar 2022 04:10:38 +0000 (12:10 +0800)
autoload/lsp/handlers.vim

index 3ad2adb05c53038206691df9d1e7c6ee47ddbdb5..ec37783477e38da893e088bcb5628865d35b434e 100644 (file)
@@ -799,6 +799,16 @@ def ProcessUnsupportedNotif(lspserver: dict<any>, reply: dict<any>)
   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<bool> = {}
+# process unsupported notification messages but only notify once
+def ProcessUnsupportedNotifOnce(lspserver: dict<any>, reply: dict<any>)
+  if !ftypeNtfOnceMap->get(&ft, v:false)
+       ProcessUnsupportedNotif(lspserver, reply)
+       ftypeNtfOnceMap->extend({[&ft]: v:true})
+  endif
+enddef
+
 # ignore unsupported notification message
 def IgnoreNotif(lspserver: dict<any>, reply: dict<any>)
 enddef
@@ -811,7 +821,7 @@ export def ProcessNotif(lspserver: dict<any>, reply: dict<any>): 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