autoload/lsp/handlers.vim | 24 ++++++++++++++---------- autoload/lsp/lsp.vim | 4 ++-- autoload/lsp/util.vim | 4 ++-- diff --git a/autoload/lsp/handlers.vim b/autoload/lsp/handlers.vim index d0dbfffb0ad1aa4e2be160ff45a480190ef6a94c..45acb704bfc609c2585c3ca347d7bca9471cb735 100644 --- a/autoload/lsp/handlers.vim +++ b/autoload/lsp/handlers.vim @@ -70,16 +70,16 @@ enddef # process unsupported notification messages def ProcessUnsupportedNotif(lspserver: dict, reply: dict) - 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 = {} -# process unsupported notification messages but only notify once +# Dict to process telemetry notification messages only once per filetype +var telemetryProcessed: dict = {} +# process unsupported notification messages only once def ProcessUnsupportedNotifOnce(lspserver: dict, reply: dict) - 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 @@ # notification which is not in the LSP specification. '$/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 @@ lsp_notif_handlers[reply.method](lspserver, reply) 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 @@ lspRequestHandlers[request.method](lspserver, request) 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 diff --git a/autoload/lsp/lsp.vim b/autoload/lsp/lsp.vim index a94940767f263aaefca096caad4b34f72000d589..adc8e7cb5c0a4f1a649ce44b414ab7c6a008cf7c 100644 --- a/autoload/lsp/lsp.vim +++ b/autoload/lsp/lsp.vim @@ -595,7 +595,7 @@ util.ErrMsg('LSP server information is missing filetype or path') 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 @@ continue 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 diff --git a/autoload/lsp/util.vim b/autoload/lsp/util.vim index 34fc5a67e9baaebbffe21386cc7785575d6a44ed..eb0a64fb9942244784a0666a0cfac0f6ff3f3fae 100644 --- a/autoload/lsp/util.vim +++ b/autoload/lsp/util.vim @@ -210,7 +210,7 @@ if byteIdx == ltext->strlen() # 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 @@ if byteIdx != -1 if byteIdx == ltext->strlen() return ltext->strchars() else - return ltext->charidx(byteIdx, v:true) + return ltext->charidx(byteIdx, true) endif endif