From cd7288f2b797f4bc128295764b2e67690903c60a Mon Sep 17 00:00:00 2001 From: "shane.xb.qian" Date: Fri, 11 Mar 2022 10:22:16 +0800 Subject: [PATCH] shane/mdf: to avoid if location (result) of defDecl was null --- autoload/lsp/handlers.vim | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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) -- 2.48.1