update TS fold

pull/197/head
ray-x 2 years ago
parent 48e35f4e56
commit 7bfd9157fe

@ -17,15 +17,14 @@ function M.on_attach()
-- M.update_folds()
end
function Custom_fold_text()
function NG_custom_fold_text()
local line = vim.fn.getline(vim.v.foldstart)
local line_count = vim.v.foldend - vim.v.foldstart + 1
-- log("" .. line .. " // " .. line_count .. " lines")
return '' .. line .. ': ' .. line_count .. ' lines'
end
vim.opt.foldtext = Custom_fold_text()
vim.opt.foldtext = NG_custom_fold_text()
vim.opt.fillchars = { eob = '-', fold = ' ' }
vim.opt.viewoptions:remove('options')
@ -39,7 +38,7 @@ function M.setup_fold()
api.nvim_command('augroup FoldingCommand')
api.nvim_command('autocmd! * <buffer>')
api.nvim_command('augroup end')
vim.opt.foldtext = 'v:lua.custom_fold_text()'
vim.opt.foldtext = 'v:lua.NG_custom_fold_text()'
vim.opt.fillchars = { eob = '-', fold = ' ' }
vim.opt.viewoptions:remove('options')

@ -423,6 +423,10 @@ local function get_all_nodes(bufnr, filter, summary)
indent = string.rep(' ', #parents - 1) .. ''
end
item.indent = indent
item.indent_level = #parents
if #all_nodes >= 1 then
all_nodes[#all_nodes].next_indent_level = #parents
end
item.text = string.format(' %s %s%-10s\t %s', item.kind, indent, item.node_text, item.full_text)
if #item.text > length then

Loading…
Cancel
Save