aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/buf.lua
diff options
context:
space:
mode:
authorJonas Strittmatter <40792180+smjonas@users.noreply.github.com>2023-06-17 08:01:31 +0200
committerGitHub <noreply@github.com>2023-06-17 08:01:31 +0200
commitc07dceba335c56c9a356395ad0d1e5a14d416752 (patch)
tree9ea6cbcca5d3a0e2986ad17e9685d3681e67800c /runtime/lua/vim/lsp/buf.lua
parent4e63104c47132adee7d1dc678d69d80e867371bf (diff)
downloadrneovim-c07dceba335c56c9a356395ad0d1e5a14d416752.tar.gz
rneovim-c07dceba335c56c9a356395ad0d1e5a14d416752.tar.bz2
rneovim-c07dceba335c56c9a356395ad0d1e5a14d416752.zip
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
Diffstat (limited to 'runtime/lua/vim/lsp/buf.lua')
-rw-r--r--runtime/lua/vim/lsp/buf.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index bb3ca0e6d6..e0034cf86e 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -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