Skip to content
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

fix: neovim 0.9 vim.treesitter.parse_query deprecation #784

Merged
merged 2 commits into from
Mar 27, 2023

Conversation

nagua
Copy link
Contributor

@nagua nagua commented Mar 27, 2023

Hello everyone,

neovim 0.9 deprecated the vim.treesitter.parse_query call a few days ago.
You should now use vim.treesitter.query.parse instead.

I introduced a new neorg.utils.ts_parse_query function that will check the
neovim version used and use the right call. I replaced all usage of parse_query
with the new function.

Have a great day everyone!

@nagua nagua force-pushed the update-neovim-treesitter-api branch from 4cc4c3b to 70e714c Compare March 27, 2023 15:11
--- @param query_string string # Query in s-expr syntax
--- @return any # Parsed query
ts_parse_query = function(language, query_string)
if vim.fn.has("nvim-0.9") == 1 then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking like this will break things for people with an outdated nightly (like me)
you should do if vim.treeistter.query.parse then

@vhyrro
Copy link
Member

vhyrro commented Mar 27, 2023

Thanks a lot for the PR! Fixed that bit that max was talking about and now we should be good :)

@vhyrro vhyrro changed the title chore: Fix neovim 0.9 vim.treesitter.parse_query deprecation fix: neovim 0.9 vim.treesitter.parse_query deprecation Mar 27, 2023
@vhyrro vhyrro merged commit f4a9759 into nvim-neorg:main Mar 27, 2023
@nagua nagua deleted the update-neovim-treesitter-api branch March 27, 2023 21:41
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.

3 participants