Skip to content

Commit

Permalink
fix(nvim-lsp-file-operations): conditionally enable capabilities to l…
Browse files Browse the repository at this point in the history
…anguage servers
  • Loading branch information
mehalter committed Jun 16, 2024
1 parent 29d0fd6 commit 79ed791
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lua/astrocommunity/lsp/nvim-lsp-file-operations/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ return {
lazy = true,
-- lazily load plugin after a tree plugin is loaded
init = function(plugin) require("astrocore").on_load({ "neo-tree.nvim", "nvim-tree.lua" }, plugin.name) end,
dependencies = {
"AstroNvim/astrolsp",
opts = function(_, opts)
local operations = vim.tbl_get(require("astrocore").plugin_opts "nvim-lsp-file-operations", "operations") or {}
local fileOperations = {}
for _, operation in ipairs { "willRename", "didRename", "willCreate", "didCreate", "willDelete", "didDelete" } do
local enabled = vim.tbl_get(operations, operation .. "Files")
if enabled == nil then enabled = true end
fileOperations[operation] = enabled
end
opts.capabilities =
vim.tbl_deep_extend("force", opts.capabilities or {}, { workspace = { fileOperations = fileOperations } })
end,
},
main = "lsp-file-operations", -- set the main module name where the `setup` function is
opts = {},
}

0 comments on commit 79ed791

Please sign in to comment.