Skip to content

fix from_cursor_pos for Neovim after fd1e019#1430

Merged
L3MON4D3 merged 4 commits intoL3MON4D3:masterfrom
kmoschcau:master
Mar 21, 2026
Merged

fix from_cursor_pos for Neovim after fd1e019#1430
L3MON4D3 merged 4 commits intoL3MON4D3:masterfrom
kmoschcau:master

Conversation

@kmoschcau
Copy link
Copy Markdown
Contributor

Closes #1429
See: neovim/neovim@fd1e019

I'm not sure how to best achieve backward compatibility here. I can look into doing it via the return values or whether the function throws or not, if you want.

@leiserfg
Copy link
Copy Markdown
Contributor

There are more instances of get_parser in the codebase, can you make a wrapper for the old api that behaves like the new one and do the replacements?

@kmoschcau
Copy link
Copy Markdown
Contributor Author

@leiserfg sure! Do you have a specific spot in the code-base where shims/wrappers like that belong?

@leiserfg
Copy link
Copy Markdown
Contributor

Just make a file in utils.

@kmoschcau
Copy link
Copy Markdown
Contributor Author

@leiserfg Can do. Although I already did have a look around in the meantime. Wouldn't extras/_treesitter.lua be a better fit?

This is done to normalize the throwing behavior of the old version to
the behavior of the new version, which returns errors as values.

Closes L3MON4D3#1429
@kmoschcau
Copy link
Copy Markdown
Contributor Author

kmoschcau commented Mar 19, 2026

Done. Weirdly enough, call sites in extras/treesitter_postfix.lua and extras/_treesitter.lua were already treating vim.treesitter.get_parser() as if it was the new, non-throwing version.

@L3MON4D3
Copy link
Copy Markdown
Owner

Thank you for the PR @kmoschcau, and @leiserfg for handling it 🙏🙏
I'm taking a quick look locally, and will merge ASAP :)

@L3MON4D3
Copy link
Copy Markdown
Owner

Okay, I can't get the tests for master running right now, but this change seem correct, and works for 0.7 and 0.9, so I'll take it :)
TY!!!

@L3MON4D3 L3MON4D3 merged commit 86629c1 into L3MON4D3:master Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LuaSnip errors when from_cursor_pos is called

3 participants