Skip to content

chore(text area): prepare for tree-sitter breaking changes #5965

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

Conversation

TomJGooding
Copy link
Contributor

Important

DO NOT MERGE!

Temporarily install tree-sitter from GitHub to test against breaking changes before v0.25.0 is released on PyPI.

Please review the following checklist.

  • Docstrings on all new or modified functions / classes
  • Updated documentation
  • Updated CHANGELOG.md (where appropriate)

Temporarily install tree-sitter from GitHub to test against breaking
changes before v0.25.0 is released on PyPI.
Fix breaking change in tree-sitter v0.25.0 where `Query.captures` has
been moved to `QueryCursor.captures`.

Related PR: tree-sitter/py-tree-sitter#333
@TomJGooding
Copy link
Contributor Author

This apparently causes some (strange?) changes in the syntax highlighting, which is why the snapshot tests are failing:

snapshot report; https://github.com/Textualize/textual/actions/runs/16304923238/artifacts/3540275570

@TomJGooding
Copy link
Contributor Author

TomJGooding commented Jul 17, 2025

This might have revealed a possible bug in the current Python syntax highlighting. It looks like any variables are currently being highlighted as variable.builtin, whereas I think this should be variable.

`lua-match` is specific to tree-sitter in Neovim. Currently these
query predicates are ignored so highlight much more they should!
@TomJGooding
Copy link
Contributor Author

This actually revealed another bug, where the query predicates were being ignored so highlighting much more they should!

After the fix in b85d4f3, the failing snapshots look much better: https://github.com/Textualize/textual/actions/runs/16349424666/artifacts/3556076660

run: |
poetry run pytest tests -v --cov=./src/textual --cov-report=xml:./coverage.xml --cov-report term-missing -m 'not syntax'
if: ${{ matrix.python-version == '3.8' }}
if: ${{ matrix.python-version == '3.8' || matrix.python-version == '3.9' }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps time to drop support for Python 3.8 - it's been end-of-life for a long time now.

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.

1 participant