Repository navigation
Conversation
vim.treesitter.get_parser now returns nil (not an error) for buffers without a parser, so pcall returns true and the subsequent get_node call dereferences a nil parser in for_each_tree. Capture the return value and gate on parser ~= nil so .txt and other parser-less filetypes no-op instead of crashing. Fixes folke#54 Signed-off-by: Sai Asish <say.apm35@gmail.com>
|
hi. any update ? |
Author
|
Yeah, still relevant. The patch captures the parser returned by get_parser and gates on it being non-nil, so buffers without a parser (txt and similar) fall through to the line-based path instead of crashing in get_node. It's still based on current main and mergeable, ready whenever you get a chance to look. |
Chiarandini
added a commit
to Chiarandini/NoetherVim
that referenced
this pull request
Nov 6, 2026
twilight.nvim asks for a buffer's parser expecting an error when there is none, but Neovim 0.12 returns nil, so zen mode crashed in any buffer without a treesitter parser. twilight has had no commit since October 2025 and the fix (folke/twilight.nvim#55) is unmerged. Snacks.zen and Snacks.dim do the same with what NoetherVim already ships, falling back to indent scopes where there is no parser. <leader>z and :ZenMode work as before; zen-mode.nvim and twilight.nvim go.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
vim.treesitter.get_parserreturnsnil(not an error) on Neovim 0.12 for buffers without a parser, sopcall(vim.treesitter.get_parser, buf)returnstrueand the subsequentget_nodecall dereferences a nil parser infor_each_tree. Capture the second return value and gate onparser ~= nilso.txtand other parser-less filetypes no-op instead of crashing.Related Issue(s)