aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/codelens.lua
diff options
context:
space:
mode:
authorYi Ming <ofseed@foxmail.com>2024-04-10 18:23:47 +0800
committerGitHub <noreply@github.com>2024-04-10 12:23:47 +0200
commitb95b6ed9753da8f157d3ba34408c4c2e0de9d744 (patch)
tree947a02ee07acbdf94206eea5f1e9a2c280f3d73d /runtime/lua/vim/lsp/codelens.lua
parent49983387ffd54fe0888f17098e43318a443315ac (diff)
downloadrneovim-b95b6ed9753da8f157d3ba34408c4c2e0de9d744.tar.gz
rneovim-b95b6ed9753da8f157d3ba34408c4c2e0de9d744.tar.bz2
rneovim-b95b6ed9753da8f157d3ba34408c4c2e0de9d744.zip
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 (limited to 'runtime/lua/vim/lsp/codelens.lua')
-rw-r--r--runtime/lua/vim/lsp/codelens.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua
index d2557ca9d7..90ca83cd59 100644
--- 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