Skip to content

fix(view): handle get_parser returning nil on Neovim 0.12 - #57

Open
Chiarandini wants to merge 1 commit into
folke:mainfrom
Chiarandini:fix/no-parser
Open

Chiarandini wants to merge 1 commit into
folke:mainfrom
Chiarandini:fix/no-parser

Conversation

@Chiarandini

Copy link
Copy Markdown

On Neovim 0.12, vim.treesitter.get_parser() returns nil for a buffer without a parser instead of raising, so the pcall in get_context succeeds and get_node indexes nil:

view.lua:102: attempt to index local 'parser' (a nil value)

Reproduce with nvim --clean, twilight on the runtimepath, a .txt buffer and :Twilight. Checking the returned parser restores the indentation fallback for those buffers; buffers with a parser still use tree-sitter. Tested on 0.12.6 and nightly.

@github-actions github-actions Bot added the size/s Small PR (<10 lines changed) label Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s Small PR (<10 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant