mirror of
https://github.com/neovim/neovim.git
synced 2025-11-22 10:06:33 +00:00
fix(lsp): allow Lua pattern chars in code action filter (#24041)
Previously, filtering code actions with the "only" option failed if the code action kind contained special Lua pattern chars such as "-" (e.g. the ocaml language server supports a "type-annotate" code action). Solution: use string comparison instead of string.find
This commit is contained in:
committed by
GitHub
parent
4e63104c47
commit
c07dceba33
@@ -608,9 +608,9 @@ local function on_code_action_results(results, ctx, options)
|
||||
end
|
||||
local found = false
|
||||
for _, o in ipairs(options.context.only) do
|
||||
-- action kinds are hierarchical with . as a separator: when requesting only
|
||||
-- 'quickfix' this filter allows both 'quickfix' and 'quickfix.foo', for example
|
||||
if a.kind:find('^' .. o .. '$') or a.kind:find('^' .. o .. '%.') then
|
||||
-- action kinds are hierarchical with . as a separator: when requesting only 'type-annotate'
|
||||
-- this filter allows both 'type-annotate' and 'type-annotate.foo', for example
|
||||
if a.kind == o or vim.startswith(a.kind, o .. '.') then
|
||||
found = true
|
||||
break
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user