mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-03-10 09:27:25 +00:00
fix(lsp.keymaps): make cond -> enabled work again. Closes #6697
This commit is contained in:
@@ -92,13 +92,13 @@ return {
|
||||
{ "<leader>cr", vim.lsp.buf.rename, desc = "Rename", has = "rename" },
|
||||
{ "<leader>cA", LazyVim.lsp.action.source, desc = "Source Action", has = "codeAction" },
|
||||
{ "]]", function() Snacks.words.jump(vim.v.count1) end, has = "documentHighlight",
|
||||
desc = "Next Reference", cond = function() return Snacks.words.is_enabled() end },
|
||||
desc = "Next Reference", enabled = function() return Snacks.words.is_enabled() end },
|
||||
{ "[[", function() Snacks.words.jump(-vim.v.count1) end, has = "documentHighlight",
|
||||
desc = "Prev Reference", cond = function() return Snacks.words.is_enabled() end },
|
||||
desc = "Prev Reference", enabled = function() return Snacks.words.is_enabled() end },
|
||||
{ "<a-n>", function() Snacks.words.jump(vim.v.count1, true) end, has = "documentHighlight",
|
||||
desc = "Next Reference", cond = function() return Snacks.words.is_enabled() end },
|
||||
desc = "Next Reference", enabled = function() return Snacks.words.is_enabled() end },
|
||||
{ "<a-p>", function() Snacks.words.jump(-vim.v.count1, true) end, has = "documentHighlight",
|
||||
desc = "Prev Reference", cond = function() return Snacks.words.is_enabled() end },
|
||||
desc = "Prev Reference", enabled = function() return Snacks.words.is_enabled() end },
|
||||
},
|
||||
},
|
||||
stylua = { enabled = false },
|
||||
|
||||
@@ -3,8 +3,8 @@ local M = {}
|
||||
---@type LazyKeysLspSpec[]|nil
|
||||
M._keys = {}
|
||||
|
||||
---@alias LazyKeysLspSpec LazyKeysSpec|{has?:string|string[], cond?:fun():boolean}
|
||||
---@alias LazyKeysLsp LazyKeys|{has?:string|string[], cond?:fun():boolean}
|
||||
---@alias LazyKeysLspSpec LazyKeysSpec|{has?:string|string[], enabled?:fun():boolean}
|
||||
---@alias LazyKeysLsp LazyKeys|{has?:string|string[], enabled?:fun():boolean}
|
||||
|
||||
---@deprecated
|
||||
---@return LazyKeysLspSpec[]
|
||||
@@ -43,7 +43,6 @@ function M.set(filter, spec)
|
||||
local Keys = require("lazy.core.handler.keys")
|
||||
for _, keys in pairs(Keys.resolve(spec)) do
|
||||
---@cast keys LazyKeysLsp
|
||||
if keys.cond == nil or keys.cond() then
|
||||
local filters = {} ---@type vim.lsp.get_clients.Filter[]
|
||||
if keys.has then
|
||||
local methods = type(keys.has) == "string" and { keys.has } or keys.has --[[@as string[] ]]
|
||||
@@ -59,10 +58,10 @@ function M.set(filter, spec)
|
||||
local opts = Keys.opts(keys)
|
||||
---@cast opts snacks.keymap.set.Opts
|
||||
opts.lsp = f
|
||||
opts.enabled = keys.enabled
|
||||
Snacks.keymap.set(keys.mode or "n", keys.lhs, keys.rhs, opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user