This commit is contained in:
PFiS1737 2026-05-10 22:11:03 +08:00
parent 2b0298d182
commit ac9c6d67a9
No known key found for this signature in database
GPG key ID: 24E2323523A76ED6
2 changed files with 12 additions and 12 deletions

View file

@ -161,7 +161,7 @@ if vim.lsp.inlay_hint then
Snacks.toggle.inlay_hints():map("<leader>uh")
end
if vim.lsp.codelens.enable then
if vim.fn.has("nvim-0.12") == 1 then
if Snacks.toggle.codelens then
Snacks.toggle.codelens():map("<leader>cC")
else
@ -177,6 +177,10 @@ if vim.lsp.codelens.enable then
end,
}):map("<leader>cC")
end
else
require("lazyvim.plugins.lsp.keymaps").set({}, {
{ "<leader>cC", vim.lsp.codelens.refresh, desc = "Refresh & Display Codelens", mode = { "n" }, has = "codeLens" },
})
end
-- lazygit

View file

@ -201,18 +201,14 @@ return {
-- code lens
if opts.codelens.enabled then
Snacks.util.lsp.on({ method = "textDocument/codeLens" }, function(buffer)
if vim.lsp.codelens.enable then
-- nvim v0.12
if
vim.api.nvim_buf_is_valid(buffer)
and vim.bo[buffer].buftype == ""
and not vim.tbl_contains(opts.codelens.exclude, vim.bo[buffer].filetype)
then
if
vim.api.nvim_buf_is_valid(buffer)
and vim.bo[buffer].buftype == ""
and not vim.tbl_contains(opts.codelens.exclude, vim.bo[buffer].filetype)
then
if vim.fn.has("nvim-0.12") == 1 then
vim.lsp.codelens.enable(true, { bufnr = buffer })
end
else
-- nvim v0.11
if not vim.tbl_contains(opts.codelens.exclude, vim.bo[buffer].filetype) then
else
vim.lsp.codelens.refresh()
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave" }, {
buffer = buffer,