]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Ignore unsupported pyright language server notifications. Fixes #355
authorYegappan Lakshmanan <yegappan@yahoo.com>
Tue, 4 Jul 2023 23:03:42 +0000 (16:03 -0700)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Tue, 4 Jul 2023 23:03:42 +0000 (16:03 -0700)
autoload/lsp/handlers.vim
autoload/lsp/lsp.vim
autoload/lsp/util.vim

index d0dbfffb0ad1aa4e2be160ff45a480190ef6a94c..45acb704bfc609c2585c3ca347d7bca9471cb735 100644 (file)
@@ -70,16 +70,16 @@ enddef
 
 # process unsupported notification messages
 def ProcessUnsupportedNotif(lspserver: dict<any>, reply: dict<any>)
-  util.ErrMsg($'Unsupported notification message received from the LSP server ({lspserver.path}), message = {reply->string()}')
+  util.WarnMsg($'Unsupported notification message received from the LSP server ({lspserver.name}), 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
+# Dict to process telemetry notification messages only once per filetype
+var telemetryProcessed: dict<bool> = {}
+# process unsupported notification messages only once
 def ProcessUnsupportedNotifOnce(lspserver: dict<any>, reply: dict<any>)
-  if !ftypeNtfOnceMap->get(&ft, v:false)
-       ProcessUnsupportedNotif(lspserver, reply)
-       ftypeNtfOnceMap->extend({[&ft]: v:true})
+  if !telemetryProcessed->get(&ft, false)
+    ProcessUnsupportedNotif(lspserver, reply)
+    telemetryProcessed->extend({[&ft]: true})
   endif
 enddef
 
@@ -112,7 +112,11 @@ export def ProcessNotif(lspserver: dict<any>, reply: dict<any>): void
       '$/typescriptVersion',
       # Dart language server sends the '$/analyzerStatus' notification which
       # is not in the LSP specification.
-      '$/analyzerStatus'
+      '$/analyzerStatus',
+      # pyright language server notifications
+      'pyright/beginProgress',
+      'pyright/reportProgress',
+      'pyright/endProgress'
     ]
 
   if lsp_notif_handlers->has_key(reply.method)
@@ -120,7 +124,7 @@ export def ProcessNotif(lspserver: dict<any>, reply: dict<any>): void
   elseif lspserver.customNotificationHandlers->has_key(reply.method)
     lspserver.customNotificationHandlers[reply.method](lspserver, reply)
   elseif lsp_ignored_notif_handlers->index(reply.method) == -1
-    util.ErrMsg($'Unsupported notification received from LSP server {reply->string()}')
+    ProcessUnsupportedNotif(lspserver, reply)
   endif
 enddef
 
@@ -220,7 +224,7 @@ export def ProcessRequest(lspserver: dict<any>, request: dict<any>)
   elseif lspserver.customRequestHandlers->has_key(request.method)
     lspserver.customRequestHandlers[request.method](lspserver, request)
   elseif lspIgnoredRequestHandlers->index(request.method) == -1
-    util.ErrMsg($'Unsupported request message received from the LSP server ({lspserver.path}), message = {request->string()}')
+    util.ErrMsg($'Unsupported request message received from the LSP server ({lspserver.name}), message = {request->string()}')
   endif
 enddef
 
index a94940767f263aaefca096caad4b34f72000d589..adc8e7cb5c0a4f1a649ce44b414ab7c6a008cf7c 100644 (file)
@@ -595,7 +595,7 @@ export def AddServer(serverList: list<dict<any>>)
       continue
     endif
     # Enable omni-completion by default
-    server.omnicompl = get(server, 'omnicompl', v:true)
+    server.omnicompl = server->get('omnicompl', true)
 
     if !server.path->executable()
       if !opt.lspOptions.ignoreMissingServer
@@ -654,7 +654,7 @@ export def AddServer(serverList: list<dict<any>>)
     endif
 
     if !server->has_key('syncInit')
-      server.syncInit = v:false
+      server.syncInit = false
     endif
 
     if !server->has_key('name') || server.name->type() != v:t_string
index 34fc5a67e9baaebbffe21386cc7785575d6a44ed..eb0a64fb9942244784a0666a0cfac0f6ff3f3fae 100644 (file)
@@ -210,7 +210,7 @@ export def GetCharIdxWithoutCompChar(bnr: number, pos: dict<number>): number
       # Byte index points to the byte after the last byte.
       return ltext->strcharlen()
     else
-      return ltext->charidx(byteIdx, v:false)
+      return ltext->charidx(byteIdx, false)
     endif
   endif
 
@@ -235,7 +235,7 @@ export def GetCharIdxWithCompChar(ltext: string, charIdx: number): number
     if byteIdx == ltext->strlen()
       return ltext->strchars()
     else
-      return ltext->charidx(byteIdx, v:true)
+      return ltext->charidx(byteIdx, true)
     endif
   endif