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.
This commit is contained in:
Yi Ming 2024-04-10 18:23:47 +08:00 committed by GitHub
parent 49983387ff
commit b95b6ed975
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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