fix for new mason, rollback folding to treesitter

This commit is contained in:
Tibeuleu
2025-05-19 23:32:49 +02:00
parent 5c7fae4de6
commit 236572045c
2 changed files with 14 additions and 13 deletions

View File

@@ -25,19 +25,19 @@ require'nvim-treesitter.configs'.setup {
}
local vim = vim
-- vim.o.foldmethod = 'expr'
-- -- Default to treesitter folding
-- vim.o.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
-- -- Prefer LSP folding if client supports it
-- vim.api.nvim_create_autocmd('LspAttach', {
-- callback = function(args)
-- local client = vim.lsp.get_client_by_id(args.data.client_id)
-- if client:supports_method('textDocument/foldingRange') then
-- local win = vim.api.nvim_get_current_win()
-- vim.wo[win][0].foldexpr = 'v:lua.vim.lsp.foldexpr()'
-- end
-- end,
-- })
vim.o.foldmethod = 'expr'
-- Default to treesitter folding
vim.o.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
-- Prefer LSP folding if client supports it
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client:supports_method('textDocument/foldingRange') then
local win = vim.api.nvim_get_current_win()
vim.wo[win][0].foldexpr = 'v:lua.vim.lsp.foldexpr()'
end
end,
})
local opt = vim.opt
local api = vim.api
local M = {}