commit b95b6ed9753da8f157d3ba34408c4c2e0de9d744
parent 49983387ffd54fe0888f17098e43318a443315ac
Author: Yi Ming <ofseed@foxmail.com>
Date: Wed, 10 Apr 2024 18:23:47 +0800
fix(lsp): empty commands should not be considered executable (#28216)
According to the LSP specification, the CodeLens.command is optional but the CodeLens.command.command is not optional, which means the correct representation of a display-only code lens is indeed one with a command with a title to display and an empty string as command.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua
@@ -79,7 +79,7 @@ function M.run()
local lenses_by_client = lens_cache_by_buf[bufnr] or {}
for client, lenses in pairs(lenses_by_client) do
for _, lens in pairs(lenses) do
- if lens.range.start.line == (line - 1) then
+ if lens.range.start.line == (line - 1) and lens.command and lens.command.command ~= '' then
table.insert(options, { client = client, lens = lens })
end
end