From: shane.xb.qian Date: Fri, 11 Mar 2022 02:22:16 +0000 (+0800) Subject: shane/mdf: to avoid if location (result) of defDecl was null X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=cd7288f2b797f4bc128295764b2e67690903c60a;p=vim-lsp.git shane/mdf: to avoid if location (result) of defDecl was null --- diff --git a/autoload/lsp/handlers.vim b/autoload/lsp/handlers.vim index 89b8ddf..59abfb6b 100644 --- a/autoload/lsp/handlers.vim +++ b/autoload/lsp/handlers.vim @@ -133,14 +133,14 @@ enddef # Result: Location | Location[] | LocationLink[] | null def ProcessDefDeclReply(lspserver: dict, req: dict, reply: dict): void var location: dict - if reply.result->type() == v:t_list - if !reply.result->empty() - location = reply.result[0] - else - location = {} - endif - else + if reply.result->type() == v:t_list && !reply.result->empty() && reply.result[0]->type() == v:t_dict + location = reply.result[0] + elseif reply.result->type() == v:t_dict + # not sure if there possible 'dict' type of 'result' but just in case location = reply.result + else + # cannot assign 'null' to 'location' and/so all else cases assign '{}' + location = {} endif symbol.GotoSymbol(lspserver, location, req.method)