Skip to content

[BUG]: textual[syntax] does not install tree-sitter on Python 3.9 and syntax highlighting silently does not work #6388

@Kalebe16

Description

@Kalebe16

Summary

On Python 3.9, installing textual[syntax] does not install tree-sitter, and syntax highlighting in TextArea.code_editor(...) does not work.

There is no error — it simply falls back to plain text without highlighting.

If I manually install tree-sitter, I then get:

RuntimeError: SyntaxAwareDocument unavailable - tree-sitter is not installed.

Steps to reproduce

python3.9 -m venv venv
source venv/bin/activate
pip install textual==8.0 "textual[syntax]"
from textual.app import App, ComposeResult
from textual.widgets import TextArea

class Demo(App):
    def compose(self) -> ComposeResult:
        yield TextArea.code_editor(
            '{ "a": 1 }',
            language="json",
            theme="monokai",
        )

Demo().run()

Environment

  • python-3.9
  • textual-8.0
  • Os (ubuntu)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions