From: Yegappan Lakshmanan Date: Mon, 25 Dec 2023 15:38:39 +0000 (-0800) Subject: When displaying completion documentation, check the index is valid X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=ecaab0d0b1c9801364211f3188c62c8bb060288c;p=vim-lsp.git When displaying completion documentation, check the index is valid --- diff --git a/autoload/lsp/completion.vim b/autoload/lsp/completion.vim index 6641e20..4ab65dd 100644 --- a/autoload/lsp/completion.vim +++ b/autoload/lsp/completion.vim @@ -338,12 +338,15 @@ def ShowCompletionDocumentation(cItem: any) # check if completion item is still selected var cInfo = complete_info() - if cInfo->empty() - || !cInfo.pum_visible - || cInfo.selected == -1 - || cInfo.items[cInfo.selected]->type() != v:t_dict - || cInfo.items[cInfo.selected].user_data->type() != v:t_dict - || cInfo.items[cInfo.selected].user_data.label != cItem.label + if cInfo->empty() || !cInfo.pum_visible || cInfo.selected == -1 + return + endif + + var selItem = cInfo.items->get(cInfo.selected, {}) + if selItem->empty() + || selItem->type() != v:t_dict + || selItem.user_data->type() != v:t_dict + || selItem.user_data.label != cItem.label return endif