From 89028809459bc1e31480fba374b8dfd2e0409e75 Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Thu, 21 Sep 2023 17:01:07 +0100 Subject: [PATCH 1/3] Include highlights files in distribution --- pyproject.toml | 1 + {tree-sitter => src/textual/tree-sitter}/highlights/bash.scm | 0 {tree-sitter => src/textual/tree-sitter}/highlights/css.scm | 0 {tree-sitter => src/textual/tree-sitter}/highlights/html.scm | 0 {tree-sitter => src/textual/tree-sitter}/highlights/json.scm | 0 .../textual/tree-sitter}/highlights/markdown.scm | 0 .../textual/tree-sitter}/highlights/python.scm | 0 .../textual/tree-sitter}/highlights/regex.scm | 0 {tree-sitter => src/textual/tree-sitter}/highlights/sql.scm | 0 {tree-sitter => src/textual/tree-sitter}/highlights/toml.scm | 0 {tree-sitter => src/textual/tree-sitter}/highlights/yaml.scm | 0 src/textual/widgets/_text_area.py | 5 +++-- 12 files changed, 4 insertions(+), 2 deletions(-) rename {tree-sitter => src/textual/tree-sitter}/highlights/bash.scm (100%) rename {tree-sitter => src/textual/tree-sitter}/highlights/css.scm (100%) rename {tree-sitter => src/textual/tree-sitter}/highlights/html.scm (100%) rename {tree-sitter => src/textual/tree-sitter}/highlights/json.scm (100%) rename {tree-sitter => src/textual/tree-sitter}/highlights/markdown.scm (100%) rename {tree-sitter => src/textual/tree-sitter}/highlights/python.scm (100%) rename {tree-sitter => src/textual/tree-sitter}/highlights/regex.scm (100%) rename {tree-sitter => src/textual/tree-sitter}/highlights/sql.scm (100%) rename {tree-sitter => src/textual/tree-sitter}/highlights/toml.scm (100%) rename {tree-sitter => src/textual/tree-sitter}/highlights/yaml.scm (100%) diff --git a/pyproject.toml b/pyproject.toml index 9eaa9222d4..76a1c6f77d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,7 @@ classifiers = [ ] include = [ "src/textual/py.typed", + "tree-sitter", { path = "docs/examples", format = "sdist" }, { path = "tests", format = "sdist" }, # The reason for the slightly convoluted path specification here is that diff --git a/tree-sitter/highlights/bash.scm b/src/textual/tree-sitter/highlights/bash.scm similarity index 100% rename from tree-sitter/highlights/bash.scm rename to src/textual/tree-sitter/highlights/bash.scm diff --git a/tree-sitter/highlights/css.scm b/src/textual/tree-sitter/highlights/css.scm similarity index 100% rename from tree-sitter/highlights/css.scm rename to src/textual/tree-sitter/highlights/css.scm diff --git a/tree-sitter/highlights/html.scm b/src/textual/tree-sitter/highlights/html.scm similarity index 100% rename from tree-sitter/highlights/html.scm rename to src/textual/tree-sitter/highlights/html.scm diff --git a/tree-sitter/highlights/json.scm b/src/textual/tree-sitter/highlights/json.scm similarity index 100% rename from tree-sitter/highlights/json.scm rename to src/textual/tree-sitter/highlights/json.scm diff --git a/tree-sitter/highlights/markdown.scm b/src/textual/tree-sitter/highlights/markdown.scm similarity index 100% rename from tree-sitter/highlights/markdown.scm rename to src/textual/tree-sitter/highlights/markdown.scm diff --git a/tree-sitter/highlights/python.scm b/src/textual/tree-sitter/highlights/python.scm similarity index 100% rename from tree-sitter/highlights/python.scm rename to src/textual/tree-sitter/highlights/python.scm diff --git a/tree-sitter/highlights/regex.scm b/src/textual/tree-sitter/highlights/regex.scm similarity index 100% rename from tree-sitter/highlights/regex.scm rename to src/textual/tree-sitter/highlights/regex.scm diff --git a/tree-sitter/highlights/sql.scm b/src/textual/tree-sitter/highlights/sql.scm similarity index 100% rename from tree-sitter/highlights/sql.scm rename to src/textual/tree-sitter/highlights/sql.scm diff --git a/tree-sitter/highlights/toml.scm b/src/textual/tree-sitter/highlights/toml.scm similarity index 100% rename from tree-sitter/highlights/toml.scm rename to src/textual/tree-sitter/highlights/toml.scm diff --git a/tree-sitter/highlights/yaml.scm b/src/textual/tree-sitter/highlights/yaml.scm similarity index 100% rename from tree-sitter/highlights/yaml.scm rename to src/textual/tree-sitter/highlights/yaml.scm diff --git a/src/textual/widgets/_text_area.py b/src/textual/widgets/_text_area.py index f40478f088..48ea600716 100644 --- a/src/textual/widgets/_text_area.py +++ b/src/textual/widgets/_text_area.py @@ -44,7 +44,7 @@ _OPENING_BRACKETS = {"{": "}", "[": "]", "(": ")"} _CLOSING_BRACKETS = {v: k for k, v in _OPENING_BRACKETS.items()} -_TREE_SITTER_PATH = Path(__file__) / "../../../../tree-sitter/" +_TREE_SITTER_PATH = Path(__file__).parent / "../tree-sitter/" _HIGHLIGHTS_PATH = _TREE_SITTER_PATH / "highlights/" StartColumn = int @@ -325,7 +325,8 @@ def _get_builtin_highlight_query(language_name: str) -> str: Path(_HIGHLIGHTS_PATH.resolve()) / f"{language_name}.scm" ) highlight_query = highlight_query_path.read_text() - except OSError: + except OSError as e: + log.warning(f"Unable to load highlight query. {e}") highlight_query = "" return highlight_query From 1c8550c5f47b792e402cd0a90b56e170c0a70447 Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Thu, 21 Sep 2023 17:03:44 +0100 Subject: [PATCH 2/3] Remove redundant line from pyproject --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 76a1c6f77d..9eaa9222d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,6 @@ classifiers = [ ] include = [ "src/textual/py.typed", - "tree-sitter", { path = "docs/examples", format = "sdist" }, { path = "tests", format = "sdist" }, # The reason for the slightly convoluted path specification here is that From c033610c2631a4c87ba8bbbfb1508a2649ac4700 Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Thu, 21 Sep 2023 17:06:06 +0100 Subject: [PATCH 3/3] Added CHANGELOG for text-area hotfix --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 897297f2b3..35a0624f86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.38.1] - 2023-09-21 + +### Fixed + +- Hotfix - added missing highlight files in build distribution https://github.com/Textualize/textual/pull/3370 + ## [0.38.0] - 2023-09-21 ### Added