Skip to content

Conversation

@delphinus
Copy link
Member

Description

The nvim-treesitter main branch removed several APIs that the treesitter picker depended on:

  • parsers.get_buf_lang()
  • parsers.has_parser()
  • nvim-treesitter.locals module

This commit replaces these with Neovim's built-in treesitter APIs:

  • vim.treesitter.language.get_lang() for language detection
  • utils.has_ts_parser() for parser existence checking
  • vim.treesitter.query.get() for symbol extraction

The fix maintains backward compatibility with:

  • nvim-treesitter master branch
  • Neovim 0.9.0+

Includes fallback mechanism for languages without locals queries.

Fixes: #3547

🤖 Generated with Claude Code

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list relevant details about your configuration

  • Test A
  • Test B

Configuration:

  • Neovim version (nvim --version):
  • Operating system and version:

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

delphinus and others added 2 commits October 27, 2025 18:37
…main branch

The nvim-treesitter main branch removed several APIs that the treesitter
picker depended on:
- parsers.get_buf_lang()
- parsers.has_parser()
- nvim-treesitter.locals module

This commit replaces these with Neovim's built-in treesitter APIs:
- vim.treesitter.language.get_lang() for language detection
- utils.has_ts_parser() for parser existence checking
- vim.treesitter.query.get() for symbol extraction

The fix maintains backward compatibility with:
- nvim-treesitter master branch
- Neovim 0.9.0+

Includes fallback mechanism for languages without locals queries.

Fixes: #3547

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Remove unused prepare_match function
- Remove unused metadata variable from iter_captures loop
- Apply stylua formatting (parentheses removal, line breaks)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is excessive. Do not add AI slop to the repo for every minor fix!

table.insert(results, entry)

if query then
-- Use locals query to find definitions
Copy link
Contributor

Choose a reason for hiding this comment

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

The main branch has a locals API; normally I discourage plugins relying on nvim-treesitter directly, but in this case it would be good to exercise (and the module may be upstreamed in the future).

Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, forgot I removed it since it was unused (and untested). You may go git log spelunking to find the locals.lua and extract it for use here (it's a stand-alone file).

@clason
Copy link
Contributor

clason commented Nov 2, 2025

I think it's time to drop support for 0.9. Even Debian now ships with 0.10.4!

end
end
else
-- Fallback: use basic node types as symbols
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a separate feature and should be a separate PR; let's keep this one to the minimal(!) fix needed to not error on main.

Copy link
Contributor

@clason clason left a comment

Choose a reason for hiding this comment

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

There's too many changes in this; needs to be a minimal(!) fix.

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.

Treesitter picker is broken on main branch of nvim-treesitter

3 participants