diff --git a/lua/lazyvim/util/cmp.lua b/lua/lazyvim/util/cmp.lua index e4a7f700..6a0e0b13 100644 --- a/lua/lazyvim/util/cmp.lua +++ b/lua/lazyvim/util/cmp.lua @@ -70,6 +70,11 @@ function M.add_missing_snippet_docs(window) end end +function M.visible() + local ok, cmp = pcall(require, "cmp") + return ok and cmp.core.view:visible() +end + -- This is a better implementation of `cmp.confirm`: -- * check if the completion menu is visible without waiting for running sources -- * create an undo point before confirming diff --git a/lua/lazyvim/util/lsp.lua b/lua/lazyvim/util/lsp.lua index c01f3c94..59c35314 100644 --- a/lua/lazyvim/util/lsp.lua +++ b/lua/lazyvim/util/lsp.lua @@ -280,10 +280,11 @@ function M.words.setup(opts) if not require("lazyvim.plugins.lsp.keymaps").has(buf, "documentHighlight") then return false end + if not ({ M.words.get() })[2] then if ev.event:find("CursorMoved") then vim.lsp.buf.clear_references() - else + elseif not LazyVim.cmp.visible() then vim.lsp.buf.document_highlight() end end