File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed
Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -12,19 +12,16 @@ local config = require("astroui").config.folding
1212
1313local is_setup = false
1414local lsp_bufs = {}
15- local ts_bufs = {}
1615
1716local fold_methods = {
1817 lsp = function (lnum , bufnr )
1918 if lsp_bufs [bufnr or vim .api .nvim_get_current_buf ()] then return vim .lsp .foldexpr (lnum ) end
2019 end ,
2120 treesitter = function (lnum , bufnr )
22- if ts_bufs [bufnr ] == nil then
23- if not require (" astrocore" ).is_available " nvim-treesitter" or package.loaded [" nvim-treesitter" ] then
24- ts_bufs [bufnr ] = vim .bo .filetype and pcall (vim .treesitter .get_parser , bufnr )
25- end
21+ local treesitter = require " astrocore.treesitter"
22+ if treesitter .has_parser (bufnr , " folds" ) and treesitter .is_enabled (bufnr ) then
23+ return vim .treesitter .foldexpr (lnum )
2624 end
27- if ts_bufs [bufnr ] then return vim .treesitter .foldexpr (lnum ) end
2825 end ,
2926 indent = function (lnum , bufnr )
3027 if not lnum then lnum = vim .v .lnum end
Original file line number Diff line number Diff line change 190190function M .treesitter_available (bufnr )
191191 if type (bufnr ) == " table" then bufnr = bufnr .bufnr end
192192 if not bufnr then bufnr = vim .api .nvim_get_current_buf () end
193- return vim .treesitter . highlighter . active [ bufnr ] ~= nil
193+ return require ( " astrocore .treesitter" ). is_enabled ( bufnr )
194194end
195195
196196--- A condition function if the foldcolumn is enabled
You can’t perform that action at this time.
0 commit comments