Skip to content

Commit

Permalink
Move tree-sitter and tree_sitter_languages to optional extras (#3398)
Browse files Browse the repository at this point in the history
* Move tree-sitter and tree_sitter_languages to optional extras

* Update docs and GitHub action for moving syntax to extras

* Updating, remake lockfile

* Update snapshots from textual-dev change

* Improve warning when a language is set but tree-sitter not available

* Update CHANGELOG

* Add note on syntax extras

* Update lock
  • Loading branch information
darrenburns authored Oct 9, 2023
1 parent c88c031 commit d2320f1
Show file tree
Hide file tree
Showing 6 changed files with 1,278 additions and 1,136 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: poetry install
run: poetry install --extras syntax
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
# - name: Typecheck with mypy
# run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- Breaking change: tree-sitter and tree-sitter-languages dependencies moved to `syntax` extra https://github.com/Textualize/textual/pull/3398
- `Pilot.click`/`Pilot.hover` now raises `OutOfBounds` when clicking outside visible screen https://github.com/Textualize/textual/pull/3360
- `Pilot.click`/`Pilot.hover` now return a Boolean indicating whether the click/hover landed on the widget that matches the selector https://github.com/Textualize/textual/pull/3360
- Added a delay to when the `No Matches` message appears in the command palette, thus removing a flicker https://github.com/Textualize/textual/pull/3399
Expand Down
19 changes: 19 additions & 0 deletions docs/widgets/text_area.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,25 @@ Supports syntax highlighting for a selection of languages.

## Guide

### Syntax highlighting dependencies

To enable syntax highlighting, you'll need to install the `syntax` extra dependencies:

=== "pip"

```
pip install "textual[syntax]"
```

=== "poetry"

```
poetry add "textual[syntax]"
```

This will install `tree-sitter` and `tree-sitter-languages`.
These packages are distributed as binary wheels, so it may limit your applications ability to run in environments where these wheels are not supported.

### Loading text

In this example we load some initial text into the `TextArea`, and set the language to `"python"` to enable syntax highlighting.
Expand Down
Loading

0 comments on commit d2320f1

Please sign in to comment.