From aebdaebb37cfee70b5527d9e1ce0460756fce885 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 23 Apr 2022 12:17:59 +0800 Subject: [PATCH] pref(bundle): update bundle deoplete-lsp --- bundle/README.md | 2 +- bundle/deoplete-lsp/lua/candidates.lua | 4 ++-- .../rplugin/python3/deoplete/source/lsp.py | 19 +++++++++++-------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/bundle/README.md b/bundle/README.md index e2095212e..87a1f7f2b 100644 --- a/bundle/README.md +++ b/bundle/README.md @@ -19,7 +19,7 @@ In `bundle/` directory, there are two kinds of plugins: forked plugins without c - [dein.vim](https://github.com/Shougo/dein.vim/tree/772ae08cef5e712b2b31b4aaee908fc853accd94) - [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim/tree/17a83ea765831cb0cc64f768b8c3f43479b90bbe) - [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig/tree/507f8a570ac2b8b8dabdd0f62da3b3194bf822f8) -- [deoplete-lsp](https://github.com/deoplete-plugins/deoplete-lsp/tree/6299a22bedfb4f814d95cb0010291501472f8fd0) +- [deoplete-lsp](https://github.com/deoplete-plugins/deoplete-lsp/tree/c466c955e85d995984a8135e16da71463712e5e5) - [nvim-cmp](https://github.com/hrsh7th/nvim-cmp/tree/3192a0c57837c1ec5bf298e4f3ec984c7d2d60c0) - [coc-neosnippet](https://github.com/notomo/cmp-neosnippet/tree/2d14526af3f02dcea738b4cea520e6ce55c09979) - [deoplete](https://github.com/Shougo/deoplete.nvim/tree/1c40f648d2b00e70beb4c473b7c0e32b633bd9ae) diff --git a/bundle/deoplete-lsp/lua/candidates.lua b/bundle/deoplete-lsp/lua/candidates.lua index cb8370d1c..5478b44aa 100644 --- a/bundle/deoplete-lsp/lua/candidates.lua +++ b/bundle/deoplete-lsp/lua/candidates.lua @@ -7,9 +7,9 @@ local api = vim.api local get_candidates = function(_, arg1, arg2) - -- For neovim 0.6 breaking changes + -- For neovim 0.5.1/0.6 breaking changes -- https://github.com/neovim/neovim/pull/15504 - local result = (vim.fn.has('nvim-0.6') == 1 + local result = ((vim.fn.has('nvim-0.6') == 1 or vim.fn.has('nvim-0.5.1')) and type(arg1) == 'table' and arg1 or arg2) if not result or result == 0 then return diff --git a/bundle/deoplete-lsp/rplugin/python3/deoplete/source/lsp.py b/bundle/deoplete-lsp/rplugin/python3/deoplete/source/lsp.py index 134522920..032501ecb 100644 --- a/bundle/deoplete-lsp/rplugin/python3/deoplete/source/lsp.py +++ b/bundle/deoplete-lsp/rplugin/python3/deoplete/source/lsp.py @@ -100,15 +100,18 @@ class Source(Base): vars['deoplete#source#lsp#_complete_position'] = context[ 'complete_position'] - params = self.vim.call( - 'luaeval', - 'vim.lsp.util.make_position_params()') - - self.vim.call( - 'luaeval', 'require("candidates").request_candidates(' - '_A.arguments)', - {'arguments': params}) + # Note: request_candidates() may be failed + try: + params = self.vim.call( + 'luaeval', + 'vim.lsp.util.make_position_params()') + self.vim.call( + 'luaeval', 'require("candidates").request_candidates(' + '_A.arguments)', + {'arguments': params}) + except Exception: + pass return [] def process_candidates(self):