Skip to content

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

Closed
TomJGooding wants to merge 5 commits into
Textualize:mainfrom
TomJGooding:chore-text-area-prepare-for-tree-sitter-breaking-changes
Closed

chore(text area): prepare for tree-sitter breaking changes#5965
TomJGooding wants to merge 5 commits into
Textualize:mainfrom
TomJGooding:chore-text-area-prepare-for-tree-sitter-breaking-changes

Conversation

@TomJGooding

Copy link
Copy Markdown
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
Copy Markdown
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

TomJGooding commented Jul 17, 2025

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
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.

@TomJGooding TomJGooding deleted the chore-text-area-prepare-for-tree-sitter-breaking-changes branch September 1, 2025 15:23
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