-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toggle_view treesitter error #128
Comments
It was a bug in my config.. |
My config contains vim.opt.foldmethod = 'expr'
vim.opt.foldexpr = 'v:lua.vim.treesitter.foldexpr()' Removing that resolves this error. |
Can you look if this fixes your issue? https://github.com/neovim/neovim/issues/23964#issuecomment-1584411926\ /edit: Tried that, didn't work, even if it's supposed to work 🙈 |
closes: #128. This also sets the ft to the correct "text" one, as fallback value for when we don't know the ft.
closes: #128. This also sets the ft to the correct "text" one, as fallback value for when we don't know the ft.
Okay, you should change your config part to something like this: local function enable_foldexpr()
vim.opt_local.foldexpr = "v:lua.vim.treesitter.foldexpr()"
vim.opt_local.foldmethod = "expr"
end
vim.api.nvim_create_autocmd("FileType", {
callback = function(ev)
local has_treesitter = pcall(function()
vim.treesitter.get_parser(ev.buf)
end)
if has_treesitter then
enable_foldexpr()
end
end,
}) This makes sure, that only on buffers with a treesitter parser attached to it your config will get applied. Then |
Thanks @gorillamoe works for me EDIT: I don't think that the method you provided is necessary since the But the v3.0.1 works just fine so everything is good |
Still have some issue here. the fold level of the result buffer view didn't calculate correctly. so update: |
When setup ``` lua vim.opt.foldmethod = 'expr' vim.opt.foldexpr = 'v:lua.vim.treesitter.foldexpr()' ``` the fold level per lines not getting correct result, this means that `zc` `zo` will not work in result buffer. this commit fix it. Related mistweaverco#128
When setup ``` lua vim.opt.foldmethod = 'expr' vim.opt.foldexpr = 'v:lua.vim.treesitter.foldexpr()' ``` the fold level per lines not getting correct result, this means that `zc` `zo` will not work in result buffer. this commit fix it. Related #128
When setup ``` lua vim.opt.foldmethod = 'expr' vim.opt.foldexpr = 'v:lua.vim.treesitter.foldexpr()' ``` the fold level per lines not getting correct result, this means that `zc` `zo` will not work in result buffer. this commit fix it. Related mistweaverco#128
When setup ``` lua vim.opt.foldmethod = 'expr' vim.opt.foldexpr = 'v:lua.vim.treesitter.foldexpr()' ``` the fold level per lines not getting correct result, this means that `zc` `zo` will not work in result buffer. this commit fix it. Related mistweaverco#128
I'm getting this error when running
toggle_view()
This happens when switching from Body to Header view
Here's my config if it helps
The text was updated successfully, but these errors were encountered: