diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index d144fb8163..9df7cf2fbf 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -35,18 +35,18 @@ jobs: cache: "poetry" - name: Install dependencies run: poetry install --no-interaction --extras syntax - if: ${{ matrix.python-version != '3.13' }} - - name: Install dependencies for 3.13 + if: ${{ matrix.python-version != '3.8' }} + - name: Install dependencies for 3.8 run: poetry install --no-interaction - if: ${{ matrix.python-version == '3.13' }} - - name: Test with pytest + if: ${{ matrix.python-version == '3.8' }} + - name: Test with pytest (Py39+ - with syntax highlighting) run: | poetry run pytest tests -v --cov=./src/textual --cov-report=xml:./coverage.xml --cov-report term-missing - if: ${{ matrix.python-version != '3.13' }} - - name: Test with pytest for 3.13 + if: ${{ matrix.python-version != '3.8' }} + - name: Test with pytest (Py38 - without syntax highlighting) 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.13' }} + if: ${{ matrix.python-version == '3.8' }} - name: Upload snapshot report if: always() uses: actions/upload-artifact@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index eafd66404b..7807c1fbe0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,10 +10,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## Added - Added "tab" border style https://github.com/Textualize/textual/pull/5335 +- Added support for XML syntax highlighting https://github.com/Textualize/textual/pull/5320 +- Added `TextArea.update_highlight_query` https://github.com/Textualize/textual/pull/5320 + ## Fixed - Fixed Select not scrolling highlight in to view when clicked https://github.com/Textualize/textual/issues/5255 +- Upgraded tree-sitter to 0.23+ (`syntax` extras) https://github.com/Textualize/textual/pull/5320 +- Some syntax highlighting changes due to tree-sitter updates https://github.com/Textualize/textual/pull/5320 +- Breaking change: `Document.query_syntax_tree` signature changed https://github.com/Textualize/textual/pull/5320 +- Breaking change: `TextArea.register_language` signature changed https://github.com/Textualize/textual/pull/5320 +- Breaking change: `SyntaxAwareDocument.language_name` property removed https://github.com/Textualize/textual/pull/5320 +- Breaking change: Kotlin syntax highlighting removed from `TextArea` https://github.com/Textualize/textual/pull/5320 - Fixed selection list wrapping https://github.com/Textualize/textual/pull/5331 - Fixed CSS encoding issue on Windows https://github.com/Textualize/textual/pull/5324 diff --git a/poetry.lock b/poetry.lock index eacdc00634..8ca5e8e13b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2,13 +2,13 @@ [[package]] name = "aiohappyeyeballs" -version = "2.4.3" +version = "2.4.4" description = "Happy Eyeballs for asyncio" optional = false python-versions = ">=3.8" files = [ - {file = "aiohappyeyeballs-2.4.3-py3-none-any.whl", hash = "sha256:8a7a83727b2756f394ab2895ea0765a0a8c475e3c71e98d43d76f22b4b435572"}, - {file = "aiohappyeyeballs-2.4.3.tar.gz", hash = "sha256:75cf88a15106a5002a8eb1dab212525c00d1f4c0fa96e551c9fbe6f09a621586"}, + {file = "aiohappyeyeballs-2.4.4-py3-none-any.whl", hash = "sha256:a980909d50efcd44795c4afeca523296716d50cd756ddca6af8c65b996e27de8"}, + {file = "aiohappyeyeballs-2.4.4.tar.gz", hash = "sha256:5fdd7d87889c63183afc18ce9271f9b0a7d32c2303e394468dd45d514a757745"}, ] [[package]] @@ -1178,13 +1178,13 @@ dev = ["click", "codecov", "mkdocs-gen-files", "mkdocs-git-authors-plugin", "mkd [[package]] name = "mkdocs-material" -version = "9.5.46" +version = "9.5.47" description = "Documentation that simply works" optional = false python-versions = ">=3.8" files = [ - {file = "mkdocs_material-9.5.46-py3-none-any.whl", hash = "sha256:98f0a2039c62e551a68aad0791a8d41324ff90c03a6e6cea381a384b84908b83"}, - {file = "mkdocs_material-9.5.46.tar.gz", hash = "sha256:ae2043f4238e572f9a40e0b577f50400d6fc31e2fef8ea141800aebf3bd273d7"}, + {file = "mkdocs_material-9.5.47-py3-none-any.whl", hash = "sha256:53fb9c9624e7865da6ec807d116cd7be24b3cb36ab31b1d1d1a9af58c56009a2"}, + {file = "mkdocs_material-9.5.47.tar.gz", hash = "sha256:fc3b7a8e00ad896660bd3a5cc12ca0cb28bdc2bcbe2a946b5714c23ac91b0ede"}, ] [package.dependencies] @@ -1759,13 +1759,13 @@ extra = ["pygments (>=2.12)"] [[package]] name = "pytest" -version = "8.3.3" +version = "8.3.4" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.8" files = [ - {file = "pytest-8.3.3-py3-none-any.whl", hash = "sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2"}, - {file = "pytest-8.3.3.tar.gz", hash = "sha256:70b98107bd648308a7952b06e6ca9a50bc660be218d53c257cc1fc94fda10181"}, + {file = "pytest-8.3.4-py3-none-any.whl", hash = "sha256:50e16d954148559c9a74109af1eaf0c945ba2d8f30f0a3d3335edde19788b6f6"}, + {file = "pytest-8.3.4.tar.gz", hash = "sha256:965370d062bce11e73868e0335abac31b4d3de0e82f4007408d242b4f8610761"}, ] [package.dependencies] @@ -2114,26 +2114,6 @@ typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.1 [package.extras] jupyter = ["ipywidgets (>=7.5.1,<9)"] -[[package]] -name = "setuptools" -version = "75.6.0" -description = "Easily download, build, install, upgrade, and uninstall Python packages" -optional = false -python-versions = ">=3.9" -files = [ - {file = "setuptools-75.6.0-py3-none-any.whl", hash = "sha256:ce74b49e8f7110f9bf04883b730f4765b774ef3ef28f722cce7c273d253aaf7d"}, - {file = "setuptools-75.6.0.tar.gz", hash = "sha256:8199222558df7c86216af4f84c30e9b34a61d8ba19366cc914424cdbd28252f6"}, -] - -[package.extras] -check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)", "ruff (>=0.7.0)"] -core = ["importlib_metadata (>=6)", "jaraco.collections", "jaraco.functools (>=4)", "jaraco.text (>=3.7)", "more_itertools", "more_itertools (>=8.8)", "packaging", "packaging (>=24.2)", "platformdirs (>=4.2.2)", "tomli (>=2.0.1)", "wheel (>=0.43.0)"] -cover = ["pytest-cov"] -doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier", "towncrier (<24.7)"] -enabler = ["pytest-enabler (>=2.2)"] -test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "jaraco.test (>=5.5)", "packaging (>=24.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-home (>=0.5)", "pytest-perf", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel (>=0.44.0)"] -type = ["importlib_metadata (>=7.0.2)", "jaraco.develop (>=7.21)", "mypy (>=1.12,<1.14)", "pytest-mypy"] - [[package]] name = "six" version = "1.16.0" @@ -2261,198 +2241,368 @@ files = [ [[package]] name = "tree-sitter" -version = "0.20.4" -description = "Python bindings for the Tree-Sitter parsing library" -optional = false -python-versions = ">=3.3" -files = [ - {file = "tree_sitter-0.20.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:c259b9bcb596e54f54713eb3951226fc834d65289940f4bfdcdf519f08e8e876"}, - {file = "tree_sitter-0.20.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:88da7e2e4c69881cd63916cc24ae0b809f96aae331da45b418ae6b2d1ed2ca19"}, - {file = "tree_sitter-0.20.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:66a68b156ba131e9d8dff4a1f72037f4b368cc50c58f18905a91743ae1d1c795"}, - {file = "tree_sitter-0.20.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ae28e25d551f406807011487bdfb9728041e656b30b554fa7f3391ab64ed69f9"}, - {file = "tree_sitter-0.20.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:36b10c9c69e825ba65cf9b0f77668bf33e70d2a5764b64ad6f133f8cc9220f09"}, - {file = "tree_sitter-0.20.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:7c18c64ddd44b75b7e1660b9793753eda427e4b145b6216d4b2d2e9b200c74f2"}, - {file = "tree_sitter-0.20.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:e9e9e594bbefb76ad9ea256f5c87eba7591b4758854d3df83ce4df415933a006"}, - {file = "tree_sitter-0.20.4-cp310-cp310-win32.whl", hash = "sha256:b4755229dc18644fe48bcab974bde09b171fcb6ef625d3cb5ece5c6198f4223e"}, - {file = "tree_sitter-0.20.4-cp310-cp310-win_amd64.whl", hash = "sha256:f792684cee8a46d9194d9f4223810e54ccc704470c5777538d59fbde0a4c91bf"}, - {file = "tree_sitter-0.20.4-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:9d22ee75f45836554ee6a11e50dd8f9827941e67c49fce9a0790245b899811a9"}, - {file = "tree_sitter-0.20.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:2a0ffd76dd991ba745bb5d0ba1d583bec85726d3ddef8c9685dc8636a619adde"}, - {file = "tree_sitter-0.20.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:060d4e5b803be0975f1ac46e54a292eab0701296ccd912f6cdac3f7331e29143"}, - {file = "tree_sitter-0.20.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:822e02366dbf223697b2b56b8f91aa5b60571f9fe7c998988a381db1c69604e9"}, - {file = "tree_sitter-0.20.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:527ca72c6a8f60fa719af37fa86f58b7ad0e07b8f74d1c1c7e926c5c888a7e6b"}, - {file = "tree_sitter-0.20.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:a418ca71309ea7052e076f08d623f33f58eae01a8e8cdc1e6d3a01b5b8ddebfe"}, - {file = "tree_sitter-0.20.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:08c3ba2561b61a83c28ca06a0bce2a5ffcfb6b39f9d27a45e5ebd9cad2bedb7f"}, - {file = "tree_sitter-0.20.4-cp311-cp311-win32.whl", hash = "sha256:8d04c75a389b2de94952d602264852acff8cd3ed1ccf8a2492a080973d5ddd58"}, - {file = "tree_sitter-0.20.4-cp311-cp311-win_amd64.whl", hash = "sha256:ba9215c0e7529d9eb370528e5d99b7389d14a7eae94f07d14fa9dab18f267c62"}, - {file = "tree_sitter-0.20.4-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:c4c1af5ed4306071d30970c83ec882520a7bf5d8053996dbc4aa5c59238d4990"}, - {file = "tree_sitter-0.20.4-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:9d70bfa550cf22c9cea9b3c0d18b889fc4f2a7e9dcf1d6cc93f49fa9d4a94954"}, - {file = "tree_sitter-0.20.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6de537bca0641775d8d175d37303d54998980fc0d997dd9aa89e16b415bf0cc3"}, - {file = "tree_sitter-0.20.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9b1c0f8c0e3e50267566f5116cdceedf4e23e8c08b55ef3becbe954a11b16e84"}, - {file = "tree_sitter-0.20.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:20ef2ee6d9bb8e21713949e5ff769ed670fe1217f95b7eeb6c675788438c1e6e"}, - {file = "tree_sitter-0.20.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:b6fd1c881ab0de5faa67168db2d001eee32be5482cb4e0b21b217689a05b6fe4"}, - {file = "tree_sitter-0.20.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:bf47047420021d50aec529cb66387c90562350b499ddf56ecef1fc8255439e30"}, - {file = "tree_sitter-0.20.4-cp312-cp312-win32.whl", hash = "sha256:c16b48378041fc9702b6aa3480f2ffa49ca8ea58141a862acd569e5a0679655f"}, - {file = "tree_sitter-0.20.4-cp312-cp312-win_amd64.whl", hash = "sha256:973e871167079a1b1d7304d361449253efbe2a6974728ad563cf407bd02ddccb"}, - {file = "tree_sitter-0.20.4-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:9d33a55598dd18a4d8b869a3417de82a4812c3a7dc7e61cb025ece3e9c3e4e96"}, - {file = "tree_sitter-0.20.4-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7cee6955c2c97fc5927a41c7a8b06647c4b4d9b99b8a1581bf1183435c8cec3e"}, - {file = "tree_sitter-0.20.4-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5022bea67e479ad212be7c05b983a72e297a013efb4e8ea5b5b4d7da79a9fdef"}, - {file = "tree_sitter-0.20.4-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:640f60a5b966f0990338f1bf559455c3dcb822bc4329d82b3d42f32a48374dfe"}, - {file = "tree_sitter-0.20.4-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:0e83f641fe6f27d91bd4d259fff5d35de1567d3f581b9efe9bbd5be50fe4ddc7"}, - {file = "tree_sitter-0.20.4-cp36-cp36m-win32.whl", hash = "sha256:ce6a85027c66fa3f09d482cc6d41927ea40955f7f33b86aedd26dd932709a2c9"}, - {file = "tree_sitter-0.20.4-cp36-cp36m-win_amd64.whl", hash = "sha256:fe10779347a6c067af29cb37fd4b75fa96c5cb68f587cc9530b70fe3f2a51a55"}, - {file = "tree_sitter-0.20.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:28d5f84e34e276887e3a240b60906ca7e2b51e975f3145c3149ceed977a69508"}, - {file = "tree_sitter-0.20.4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6c913b65cbe10996116988ac436748f24883b5097e58274223e89bb2c5d1bb1a"}, - {file = "tree_sitter-0.20.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ecaed46241e071752195a628bb97d2b740f2fde9e34f8a74456a4ea8bb26df88"}, - {file = "tree_sitter-0.20.4-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:b641e88a97eab002a1736d93ef5a4beac90ea4fd6e25affd1831319b99f456c9"}, - {file = "tree_sitter-0.20.4-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:327c40f439c6155e4eee54c4657e4701a04f5f4816d9defdcb836bf65bf83d21"}, - {file = "tree_sitter-0.20.4-cp37-cp37m-win32.whl", hash = "sha256:1b7c1d95f006b3de42fbf4045bd00c273d113e372fcb6a5378e74ed120c12032"}, - {file = "tree_sitter-0.20.4-cp37-cp37m-win_amd64.whl", hash = "sha256:6140d037239a41046f5d34fba5e0374ee697adb4b48b90579c618b5402781c11"}, - {file = "tree_sitter-0.20.4-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:f42fd1104efaad8151370f1936e2a488b7337a5d24544a9ab59ba4c4010b1272"}, - {file = "tree_sitter-0.20.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:7859717c5d62ee386b3d036cab8ed0f88f8c027b6b4ae476a55a8c5fb8aab713"}, - {file = "tree_sitter-0.20.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:fdd361fe1cc68db68b4d85165641275e34b86cc26b2bab932790204fa14824dc"}, - {file = "tree_sitter-0.20.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9b8d7539075606027b67764543463ff2bc4e52f4158ef6dc419c9f5625aa5383"}, - {file = "tree_sitter-0.20.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:78e76307f05aca6cde72f3307b4d53701f34ae45f2248ceb83d1626051e201fd"}, - {file = "tree_sitter-0.20.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:dd8c352f4577f61098d06cf3feb7fd214259f41b5036b81003860ed54d16b448"}, - {file = "tree_sitter-0.20.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:281f3e5382d1bd7fccc88d1afe68c915565bc24f8b8dd4844079d46c7815b8a7"}, - {file = "tree_sitter-0.20.4-cp38-cp38-win32.whl", hash = "sha256:6a77ac3cdcddd80cdd1fd394318bff99f94f37e08d235aaefccb87e1224946e5"}, - {file = "tree_sitter-0.20.4-cp38-cp38-win_amd64.whl", hash = "sha256:8eee8adf54033dc48eab84b040f4d7b32355a964c4ae0aae5dfbdc4dbc3364ca"}, - {file = "tree_sitter-0.20.4-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:e89f6508e30fce05e2c724725d022db30d877817b9d64f933506ffb3a3f4a2c2"}, - {file = "tree_sitter-0.20.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7fb6286bb1fae663c45ff0700ec88fb9b50a81eed2bae8a291f95fcf8cc19547"}, - {file = "tree_sitter-0.20.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:11e93f8b4bbae04070416a82257a7ab2eb0afb76e093ae3ea73bd63b792f6846"}, - {file = "tree_sitter-0.20.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8250725c5f78929aeb2c71db5dca76f1ef448389ca16f9439161f90978bb8478"}, - {file = "tree_sitter-0.20.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d404a8ca9de9b0843844f0cd4d423f46bc46375ab8afb63b1d8ec01201457ac8"}, - {file = "tree_sitter-0.20.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:0f2422c9ee70ba972dfc3943746e6cf7fc03725a866908950245bda9ccfc7301"}, - {file = "tree_sitter-0.20.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:21a937942e4729abbe778a609d2c218574436cb351c36fba89ef3c8c6066ec78"}, - {file = "tree_sitter-0.20.4-cp39-cp39-win32.whl", hash = "sha256:427a9a39360cc1816e28f8182550e478e4ba983595a2565ab9dfe32ea1b03fd7"}, - {file = "tree_sitter-0.20.4-cp39-cp39-win_amd64.whl", hash = "sha256:7095bb9aff297fa9c6026bf8914fd295997d714d1a6ee9a1edf7282c772f9f64"}, - {file = "tree_sitter-0.20.4-pp310-pypy310_pp73-macosx_10_9_x86_64.whl", hash = "sha256:859260b90f0e3867ae840e39f54e830f607b3bc531bc21deeeeaa8a30cbb89ad"}, - {file = "tree_sitter-0.20.4-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0dfc14be73cf46126660a3aecdd0396e69562ad1a902245225ca7bd29649594e"}, - {file = "tree_sitter-0.20.4-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5ec46355bf3ff23f54d5e365871ffd3e05cfbc65d1b36a8be7c0bcbda30a1d43"}, - {file = "tree_sitter-0.20.4-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:d933a942fde39876b99c36f12aa3764e4a555ae9366c10ce6cca8c16341c1bbf"}, - {file = "tree_sitter-0.20.4-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:a7eec3b55135fe851a38fa248c9fd75fc3d58ceb6e1865b795e416e4d598c2a1"}, - {file = "tree_sitter-0.20.4-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dfc76225529ee14a53e84413480ce81ec3c44eaa0455c140e961c90ac3118ead"}, - {file = "tree_sitter-0.20.4-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ccf0396e47efffc0b528959a8f2e2346a98297579f867e9e1834c2aad4be829c"}, - {file = "tree_sitter-0.20.4-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:a15fbabd3bc8e29c48289c156d743e69f5ec72bb125cf44f7adbdaa1937c3da6"}, - {file = "tree_sitter-0.20.4-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:36f8adf2126f496cf376b6e4b707cba061c25beb17841727eef6f0e083e53e1f"}, - {file = "tree_sitter-0.20.4-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:841efb40c116ab0a066924925409a8a4dcffeb39a151c0b2a1c2abe56ad4fb42"}, - {file = "tree_sitter-0.20.4-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2051e8a70fd8426f27a43dad71d11929a62ce30a9b1eb65bba0ed79e82481592"}, - {file = "tree_sitter-0.20.4-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:99a3c2824d4cfcffd9f961176891426bde2cb36ece5280c61480be93319c23c4"}, - {file = "tree_sitter-0.20.4-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:72830dc85a10430eca3d56739b7efcd7a05459c8d425f08c1aee6179ab7f13a9"}, - {file = "tree_sitter-0.20.4-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4992dd226055b6cd0a4f5661c66b799a73d3eff716302e0f7ab06594ee12d49f"}, - {file = "tree_sitter-0.20.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a66d95bbf92175cdc295d6d77f330942811f02e3aaf3fc64431cb749683b2f7d"}, - {file = "tree_sitter-0.20.4-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:a25b1087e4f7825b2458dacf5f4b0be2938f78e850e822edca1ff4994b56081a"}, - {file = "tree_sitter-0.20.4.tar.gz", hash = "sha256:6adb123e2f3e56399bbf2359924633c882cc40ee8344885200bca0922f713be5"}, +version = "0.23.2" +description = "Python bindings to the Tree-sitter parsing library" +optional = true +python-versions = ">=3.9" +files = [ + {file = "tree-sitter-0.23.2.tar.gz", hash = "sha256:66bae8dd47f1fed7bdef816115146d3a41c39b5c482d7bad36d9ba1def088450"}, + {file = "tree_sitter-0.23.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:3a937f5d8727bc1c74c4bf2a9d1c25ace049e8628273016ad0d45914ae904e10"}, + {file = "tree_sitter-0.23.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2c7eae7fe2af215645a38660d2d57d257a4c461fe3ec827cca99a79478284e80"}, + {file = "tree_sitter-0.23.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3a71d607595270b6870eaf778a1032d146b2aa79bfcfa60f57a82a7b7584a4c7"}, + {file = "tree_sitter-0.23.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6fe9b9ea7a0aa23b52fd97354da95d1b2580065bc12a4ac868f9164a127211d6"}, + {file = "tree_sitter-0.23.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:d74d00a8021719eae14d10d1b1e28649e15d8b958c01c2b2c3dad7a2ebc4dbae"}, + {file = "tree_sitter-0.23.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:6de18d8d8a7f67ab71f472d1fcb01cc506e080cbb5e13d52929e4b6fdce6bbee"}, + {file = "tree_sitter-0.23.2-cp310-cp310-win_amd64.whl", hash = "sha256:12b60dca70d2282af942b650a6d781be487485454668c7c956338a367b98cdee"}, + {file = "tree_sitter-0.23.2-cp310-cp310-win_arm64.whl", hash = "sha256:3346a4dd0447a42aabb863443b0fd8c92b909baf40ed2344fae4b94b625d5955"}, + {file = "tree_sitter-0.23.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:91fda41d4f8824335cc43c64e2c37d8089c8c563bd3900a512d2852d075af719"}, + {file = "tree_sitter-0.23.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:92b2b489d5ce54b41f94c6f23fbaf592bd6e84dc2877048fd1cb060480fa53f7"}, + {file = "tree_sitter-0.23.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:64859bd4aa1567d0d6016a811b2b49c59d4a4427d096e3d8c84b2521455f62b7"}, + {file = "tree_sitter-0.23.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:614590611636044e071d3a0b748046d52676dbda3bc9fa431216231e11dd98f7"}, + {file = "tree_sitter-0.23.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:08466953c78ae57be61057188fb88c89791b0a562856010228e0ccf60e2ac453"}, + {file = "tree_sitter-0.23.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:8a33f03a562de91f7fd05eefcedd8994a06cd44c62f7aabace811ad82bc11cbd"}, + {file = "tree_sitter-0.23.2-cp311-cp311-win_amd64.whl", hash = "sha256:03b70296b569ef64f7b92b42ca5da9bf86d81bee2afd480bea35092687f51dae"}, + {file = "tree_sitter-0.23.2-cp311-cp311-win_arm64.whl", hash = "sha256:7cb4bb953ea7c0b50eeafc4454783e030357179d2a93c3dd5ebed2da5588ddd0"}, + {file = "tree_sitter-0.23.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:a014498b6a9e6003fae8c6eb72f5927d62da9dcb72b28b3ce8cd15c6ff6a6572"}, + {file = "tree_sitter-0.23.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:04f8699b131d4bcbe3805c37e4ef3d159ee9a82a0e700587625623999ba0ea53"}, + {file = "tree_sitter-0.23.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4471577df285059c71686ecb208bc50fb472099b38dcc8e849b0e86652891e87"}, + {file = "tree_sitter-0.23.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f342c925290dd4e20ecd5787ef7ae8749981597ab364783a1eb73173efe65226"}, + {file = "tree_sitter-0.23.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a4e9e53d07dd076bede72e4f7d3a0173d7b9ad6576572dd86da008a740a9bb22"}, + {file = "tree_sitter-0.23.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:8caebe65bc358759dac2500d8f8feed3aed939c4ade9a684a1783fe07bc7d5db"}, + {file = "tree_sitter-0.23.2-cp312-cp312-win_amd64.whl", hash = "sha256:fc5a72eb50d43485000dbbb309acb350467b7467e66dc747c6bb82ce63041582"}, + {file = "tree_sitter-0.23.2-cp312-cp312-win_arm64.whl", hash = "sha256:a0320eb6c7993359c5f7b371d22719ccd273f440d41cf1bd65dac5e9587f2046"}, + {file = "tree_sitter-0.23.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:eff630dddee7ba05accb439b17e559e15ce13f057297007c246237ceb6306332"}, + {file = "tree_sitter-0.23.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:4780ba8f3894f2dea869fad2995c2aceab3fd5ab9e6a27c45475d2acd7f7e84e"}, + {file = "tree_sitter-0.23.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f0b609460b8e3e256361fb12e94fae5b728cb835b16f0f9d590b5aadbf9d109b"}, + {file = "tree_sitter-0.23.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:78d070d8eaeaeb36cf535f55e5578fddbfc3bf53c1980f58bf1a99d57466b3b5"}, + {file = "tree_sitter-0.23.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:878580b2ad5054c410ba3418edca4d34c81cc26706114d8f5b5541688bc2d785"}, + {file = "tree_sitter-0.23.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:29224bdc2a3b9af535b7725e249d3ee291b2e90708e82832e73acc175e40dc48"}, + {file = "tree_sitter-0.23.2-cp313-cp313-win_amd64.whl", hash = "sha256:c58d89348162fbc3aea1fe6511a66ee189fc0e4e4bbe937026f29e4ecef17763"}, + {file = "tree_sitter-0.23.2-cp313-cp313-win_arm64.whl", hash = "sha256:0ff2037be5edab7801de3f6a721b9cf010853f612e2008ee454e0e0badb225a6"}, + {file = "tree_sitter-0.23.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:a5db8e585205faef8bf219da77d8993e2ef04d08eda2e3c8ad7e4df8297ee344"}, + {file = "tree_sitter-0.23.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9dbd110a30cf28be5da734ae4cd0e9031768228dbf6a79f2973962aa51de4ec7"}, + {file = "tree_sitter-0.23.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:569514b9a996a0fd458b3a891c46ca125298be0c03cf82f2b6f0c13d5d8f25dc"}, + {file = "tree_sitter-0.23.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a357ed98a74e47787b812df99a74a2c35c0fe11e55c2095cc01d1cad144ef552"}, + {file = "tree_sitter-0.23.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:c2dfb8e8f760f4cc67888d03ef9e2dbd3353245f67f5efba375c2a14d944ac0e"}, + {file = "tree_sitter-0.23.2-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:3ead958df87a21d706903987e665e9e0e5df7b2c5021ff69ea349826840adc6a"}, + {file = "tree_sitter-0.23.2-cp39-cp39-win_amd64.whl", hash = "sha256:611cae16be332213c0e6ece72c0bfca202e30ff320a8b309b1526c6cb79ee4ba"}, + {file = "tree_sitter-0.23.2-cp39-cp39-win_arm64.whl", hash = "sha256:b848e0fdd522fbb8888cdb4f4d93f8fad97ae10d70c122fb922e51363c7febcd"}, ] -[package.dependencies] -setuptools = {version = ">=60.0.0", markers = "python_version >= \"3.12\""} +[package.extras] +docs = ["sphinx (>=7.3,<8.0)", "sphinx-book-theme"] +tests = ["tree-sitter-html (>=0.23.0)", "tree-sitter-javascript (>=0.23.0)", "tree-sitter-json (>=0.23.0)", "tree-sitter-python (>=0.23.0)", "tree-sitter-rust (>=0.23.0)"] [[package]] -name = "tree-sitter-languages" -version = "1.10.2" -description = "Binary Python wheels for all tree sitter languages." +name = "tree-sitter-bash" +version = "0.23.3" +description = "Bash grammar for tree-sitter" optional = true -python-versions = "*" +python-versions = ">=3.9" files = [ - {file = "tree_sitter_languages-1.10.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5580348f0b20233b1d5431fa178ccd3d07423ca4a3275df02a44608fd72344b9"}, - {file = "tree_sitter_languages-1.10.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:103c7466644486b1e9e03850df46fc6aa12f13ca636c74f173270276220ac80b"}, - {file = "tree_sitter_languages-1.10.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d13db84511c6f1a7dc40383b66deafa74dabd8b877e3d65ab253f3719eccafd6"}, - {file = "tree_sitter_languages-1.10.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:57adfa32be7e465b54aa72f915f6c78a2b66b227df4f656b5d4fbd1ca7a92b3f"}, - {file = "tree_sitter_languages-1.10.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1c6385e033e460ceb8f33f3f940335f422ef2b763700a04f0089391a68b56153"}, - {file = "tree_sitter_languages-1.10.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:dfa3f38cc5381c5aba01dd7494f59b8a9050e82ff6e06e1233e3a0cbae297e3c"}, - {file = "tree_sitter_languages-1.10.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:9f195155acf47f8bc5de7cee46ecd07b2f5697f007ba89435b51ef4c0b953ea5"}, - {file = "tree_sitter_languages-1.10.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:2de330e2ac6d7426ca025a3ec0f10d5640c3682c1d0c7702e812dcfb44b58120"}, - {file = "tree_sitter_languages-1.10.2-cp310-cp310-win32.whl", hash = "sha256:c9731cf745f135d9770eeba9bb4e2ff4dabc107b5ae9b8211e919f6b9100ea6d"}, - {file = "tree_sitter_languages-1.10.2-cp310-cp310-win_amd64.whl", hash = "sha256:6dd75851c41d0c3c4987a9b7692d90fa8848706c23115669d8224ffd6571e357"}, - {file = "tree_sitter_languages-1.10.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7eb7d7542b2091c875fe52719209631fca36f8c10fa66970d2c576ae6a1b8289"}, - {file = "tree_sitter_languages-1.10.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6b41bcb00974b1c8a1800c7f1bb476a1d15a0463e760ee24872f2d53b08ee424"}, - {file = "tree_sitter_languages-1.10.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6f370cd7845c6c81df05680d5bd96db8a99d32b56f4728c5d05978911130a853"}, - {file = "tree_sitter_languages-1.10.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a1dc195c88ef4c72607e112a809a69190e096a2e5ebc6201548b3e05fdd169ad"}, - {file = "tree_sitter_languages-1.10.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9ae34ac314a7170be24998a0f994c1ac80761d8d4bd126af27ee53a023d3b849"}, - {file = "tree_sitter_languages-1.10.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:01b5742d5f5bd675489486b582bd482215880b26dde042c067f8265a6e925d9c"}, - {file = "tree_sitter_languages-1.10.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:ab1cbc46244d34fd16f21edaa20231b2a57f09f092a06ee3d469f3117e6eb954"}, - {file = "tree_sitter_languages-1.10.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:0b1149e7467a4e92b8a70e6005fe762f880f493cf811fc003554b29f04f5e7c8"}, - {file = "tree_sitter_languages-1.10.2-cp311-cp311-win32.whl", hash = "sha256:049276343962f4696390ee555acc2c1a65873270c66a6cbe5cb0bca83bcdf3c6"}, - {file = "tree_sitter_languages-1.10.2-cp311-cp311-win_amd64.whl", hash = "sha256:7f3fdd468a577f04db3b63454d939e26e360229b53c80361920aa1ebf2cd7491"}, - {file = "tree_sitter_languages-1.10.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:c0f4c8b2734c45859edc7fcaaeaab97a074114111b5ba51ab4ec7ed52104763c"}, - {file = "tree_sitter_languages-1.10.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:eecd3c1244ac3425b7a82ba9125b4ddb45d953bbe61de114c0334fd89b7fe782"}, - {file = "tree_sitter_languages-1.10.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:15db3c8510bc39a80147ee7421bf4782c15c09581c1dc2237ea89cefbd95b846"}, - {file = "tree_sitter_languages-1.10.2-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:92c6487a6feea683154d3e06e6db68c30e0ae749a7ce4ce90b9e4e46b78c85c7"}, - {file = "tree_sitter_languages-1.10.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d2f1cd1d1bdd65332f9c2b67d49dcf148cf1ded752851d159ac3e5ee4f4d260"}, - {file = "tree_sitter_languages-1.10.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:976c8039165b8e12f17a01ddee9f4e23ec6e352b165ad29b44d2bf04e2fbe77e"}, - {file = "tree_sitter_languages-1.10.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:dafbbdf16bf668a580902e1620f4baa1913e79438abcce721a50647564c687b9"}, - {file = "tree_sitter_languages-1.10.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:1aeabd3d60d6d276b73cd8f3739d595b1299d123cc079a317f1a5b3c5461e2ca"}, - {file = "tree_sitter_languages-1.10.2-cp312-cp312-win32.whl", hash = "sha256:fab8ee641914098e8933b87ea3d657bea4dd00723c1ee7038b847b12eeeef4f5"}, - {file = "tree_sitter_languages-1.10.2-cp312-cp312-win_amd64.whl", hash = "sha256:5e606430d736367e5787fa5a7a0c5a1ec9b85eded0b3596bbc0d83532a40810b"}, - {file = "tree_sitter_languages-1.10.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:838d5b48a7ed7a17658721952c77fda4570d2a069f933502653b17e15a9c39c9"}, - {file = "tree_sitter_languages-1.10.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:987b3c71b1d278c2889e018ee77b8ee05c384e2e3334dec798f8b611c4ab2d1e"}, - {file = "tree_sitter_languages-1.10.2-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:faa00abcb2c819027df58472da055d22fa7dfcb77c77413d8500c32ebe24d38b"}, - {file = "tree_sitter_languages-1.10.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e102fbbf02322d9201a86a814e79a9734ac80679fdb9682144479044f401a73"}, - {file = "tree_sitter_languages-1.10.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:8f0b87cf1a7b03174ba18dfd81582be82bfed26803aebfe222bd20e444aba003"}, - {file = "tree_sitter_languages-1.10.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:c0f1b9af9cb67f0b942b020da9fdd000aad5e92f2383ae0ba7a330b318d31912"}, - {file = "tree_sitter_languages-1.10.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:5a4076c921f7a4d31e643843de7dfe040b65b63a238a5aa8d31d93aabe6572aa"}, - {file = "tree_sitter_languages-1.10.2-cp37-cp37m-win32.whl", hash = "sha256:fa6391a3a5d83d32db80815161237b67d70576f090ce5f38339206e917a6f8bd"}, - {file = "tree_sitter_languages-1.10.2-cp37-cp37m-win_amd64.whl", hash = "sha256:55649d3f254585a064121513627cf9788c1cfdadbc5f097f33d5ba750685a4c0"}, - {file = "tree_sitter_languages-1.10.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6f85d1edaa2d22d80d4ea5b6d12b95cf3644017b6c227d0d42854439e02e8893"}, - {file = "tree_sitter_languages-1.10.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:d78feed4a764ef3141cb54bf00fe94d514d8b6e26e09423e23b4c616fcb7938c"}, - {file = "tree_sitter_languages-1.10.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:da1aca27531f9dd5308637d76643372856f0f65d0d28677d1bcf4211e8ed1ad0"}, - {file = "tree_sitter_languages-1.10.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1031ea440dafb72237437d754eff8940153a3b051e3d18932ac25e75ce060a15"}, - {file = "tree_sitter_languages-1.10.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:99d3249beaef2c9fe558ecc9a97853c260433a849dcc68266d9770d196c2e102"}, - {file = "tree_sitter_languages-1.10.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:59a4450f262a55148fb7e68681522f0c2a2f6b7d89666312a2b32708d8f416e1"}, - {file = "tree_sitter_languages-1.10.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:ce74eab0e430370d5e15a96b6c6205f93405c177a8b2e71e1526643b2fb9bab1"}, - {file = "tree_sitter_languages-1.10.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:9b4dd2b6b3d24c85dffe33d6c343448869eaf4f41c19ddba662eb5d65d8808f4"}, - {file = "tree_sitter_languages-1.10.2-cp38-cp38-win32.whl", hash = "sha256:92d734fb968fe3927a7596d9f0459f81a8fa7b07e16569476b28e27d0d753348"}, - {file = "tree_sitter_languages-1.10.2-cp38-cp38-win_amd64.whl", hash = "sha256:46a13f7d38f2eeb75f7cf127d1201346093748c270d686131f0cbc50e42870a1"}, - {file = "tree_sitter_languages-1.10.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f8c6a936ae99fdd8857e91f86c11c2f5e507ff30631d141d98132bb7ab2c8638"}, - {file = "tree_sitter_languages-1.10.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c283a61423f49cdfa7b5a5dfbb39221e3bd126fca33479cd80749d4d7a6b7349"}, - {file = "tree_sitter_languages-1.10.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:76e60be6bdcff923386a54a5edcb6ff33fc38ab0118636a762024fa2bc98de55"}, - {file = "tree_sitter_languages-1.10.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c00069f9575bd831eabcce2cdfab158dde1ed151e7e5614c2d985ff7d78a7de1"}, - {file = "tree_sitter_languages-1.10.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:475ff53203d8a43ccb19bb322fa2fb200d764001cc037793f1fadd714bb343da"}, - {file = "tree_sitter_languages-1.10.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:26fe7c9c412e4141dea87ea4b3592fd12e385465b5bdab106b0d5125754d4f60"}, - {file = "tree_sitter_languages-1.10.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:8fed27319957458340f24fe14daad467cd45021da034eef583519f83113a8c5e"}, - {file = "tree_sitter_languages-1.10.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:3657a491a7f96cc75a3568ddd062d25f3be82b6a942c68801a7b226ff7130181"}, - {file = "tree_sitter_languages-1.10.2-cp39-cp39-win32.whl", hash = "sha256:33f7d584d01a7a3c893072f34cfc64ec031f3cfe57eebc32da2f8ac046e101a7"}, - {file = "tree_sitter_languages-1.10.2-cp39-cp39-win_amd64.whl", hash = "sha256:1b944af3ee729fa70fc8ae82224a9ff597cdb63addea084e0ea2fa2b0ec39bb7"}, + {file = "tree_sitter_bash-0.23.3-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:c1ee7a46fcbfca9937d01056be756631762f53c5afdb8c4ab64eb9fed060896b"}, + {file = "tree_sitter_bash-0.23.3-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:5a090118e887bf667d82ae445794906186216f5500e0d2cd58eb499f7502dc57"}, + {file = "tree_sitter_bash-0.23.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:aa4b5dde719291eea3a81b1f9ece6afeee2deadc2b2f769bee92f955da7595cf"}, + {file = "tree_sitter_bash-0.23.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2ff7bffc3d594e7f1054de051e19df1b24082963598a175dda64083c6b3eea1a"}, + {file = "tree_sitter_bash-0.23.3-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:4427baccbd7549a2ebb1859b6d42cdab0739c05d53c2b3daad9cadc069a7b3f6"}, + {file = "tree_sitter_bash-0.23.3-cp39-abi3-win_amd64.whl", hash = "sha256:525c5cce28a7c5624fb016ac8f3ae33d32968567b718f7878c6351229d2e8394"}, + {file = "tree_sitter_bash-0.23.3-cp39-abi3-win_arm64.whl", hash = "sha256:1f703d1bf6235355f6c900be64bf9f61fc4b1d0cfed6829b4eeb74a6b41ea910"}, + {file = "tree_sitter_bash-0.23.3.tar.gz", hash = "sha256:7b15ed89a1ea8e3e3c2399758746413e464d4c1c3a6d3b75d643ae2bc2fb356b"}, ] -[package.dependencies] -tree-sitter = "*" +[package.extras] +core = ["tree-sitter (>=0.22,<1.0)"] [[package]] -name = "types-setuptools" -version = "67.8.0.0" -description = "Typing stubs for setuptools" -optional = false -python-versions = "*" +name = "tree-sitter-css" +version = "0.23.1" +description = "CSS grammar for tree-sitter" +optional = true +python-versions = ">=3.9" files = [ - {file = "types-setuptools-67.8.0.0.tar.gz", hash = "sha256:95c9ed61871d6c0e258433373a4e1753c0a7c3627a46f4d4058c7b5a08ab844f"}, - {file = "types_setuptools-67.8.0.0-py3-none-any.whl", hash = "sha256:6df73340d96b238a4188b7b7668814b37e8018168aef1eef94a3b1872e3f60ff"}, + {file = "tree_sitter_css-0.23.1-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:6b38462fef7d14b0bfa6e542faab7d3cfd267b8dc138efcf6e2cee11f6988084"}, + {file = "tree_sitter_css-0.23.1-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:33239e810c518b27fa7b4592d31f6cb63c43d4ea55532b4eb346ac4c9974a7f4"}, + {file = "tree_sitter_css-0.23.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8c4cefceb654f89de8e79563d960f87b9a4680f288d87e20bacca7c339392070"}, + {file = "tree_sitter_css-0.23.1-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6524a5d097224128c9cda797c09f5704af0705e0ff272cf2f41ec192aa06aa62"}, + {file = "tree_sitter_css-0.23.1-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:2999be3784999ced8b8d6a4470f0aec28cdc42b31fd9861041a70c834a2c8850"}, + {file = "tree_sitter_css-0.23.1-cp39-abi3-win_amd64.whl", hash = "sha256:8824f079e7454491347eda4cdbf9cde606c4e5de518cc85bb69cd9dfd67b8982"}, + {file = "tree_sitter_css-0.23.1-cp39-abi3-win_arm64.whl", hash = "sha256:6ff44819511fe517f6d32f1d8a3563da30093ca155dd1198585819598e83d755"}, + {file = "tree_sitter_css-0.23.1.tar.gz", hash = "sha256:a5dadf23e201f05606feaa638d0e423050a3d56cea2324c8859857fbbc3f69e8"}, ] +[package.extras] +core = ["tree-sitter (>=0.22,<1.0)"] + [[package]] -name = "types-tree-sitter" -version = "0.20.1.20240311" -description = "Typing stubs for tree-sitter" -optional = false -python-versions = ">=3.8" +name = "tree-sitter-go" +version = "0.23.4" +description = "Go grammar for tree-sitter" +optional = true +python-versions = ">=3.9" files = [ - {file = "types-tree-sitter-0.20.1.20240311.tar.gz", hash = "sha256:a046e3da64efa68ac23dfeb7a6fbe10787294e802c5cad46d8b6daf765f5e409"}, - {file = "types_tree_sitter-0.20.1.20240311-py3-none-any.whl", hash = "sha256:fb7babaad37c907fa11904f33bae7f8a99b1a288b3c3099ed01f527fc0073069"}, + {file = "tree_sitter_go-0.23.4-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:c9320f87a05cd47fa0f627b9329bbc09b7ed90de8fe4f5882aed318d6e19962d"}, + {file = "tree_sitter_go-0.23.4-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:914e63d16b36ab0e4f52b031e574b82d17d0bbfecca138ae83e887a1cf5b71ac"}, + {file = "tree_sitter_go-0.23.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:330ecbb38d6ea4ef41eba2d473056889705e64f6a51c2fb613de05b1bcb5ba22"}, + {file = "tree_sitter_go-0.23.4-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd14d23056ae980debfccc0db67d0a168da03792ca2968b1b5dd58ce288084e7"}, + {file = "tree_sitter_go-0.23.4-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:c3b40912487fdb78c4028860dd79493a521ffca0104f209849823358db3618a0"}, + {file = "tree_sitter_go-0.23.4-cp39-abi3-win_amd64.whl", hash = "sha256:ae4b231cad2ef76401d33617879cda6321c4d0853f7fd98cb5654c50a218effb"}, + {file = "tree_sitter_go-0.23.4-cp39-abi3-win_arm64.whl", hash = "sha256:2ac907362a3c347145dc1da0858248546500a323de90d2cb76d2a3fdbfc8da25"}, + {file = "tree_sitter_go-0.23.4.tar.gz", hash = "sha256:0ebff99820657066bec21690623a14c74d9e57a903f95f0837be112ddadf1a52"}, ] +[package.extras] +core = ["tree-sitter (>=0.22,<1.0)"] + [[package]] -name = "types-tree-sitter-languages" -version = "1.10.0.20240612" -description = "Typing stubs for tree-sitter-languages" -optional = false +name = "tree-sitter-html" +version = "0.23.2" +description = "HTML grammar for tree-sitter" +optional = true +python-versions = ">=3.9" +files = [ + {file = "tree_sitter_html-0.23.2-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:9e1641d5edf5568a246c6c47b947ed524b5bf944664e6473b21d4ae568e28ee9"}, + {file = "tree_sitter_html-0.23.2-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:3d0a83dd6cd1c7d4bcf6287b5145c92140f0194f8516f329ae8b9e952fbfa8ff"}, + {file = "tree_sitter_html-0.23.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:81b3775732fffc0abd275a419ef018fd4c1ad4044b2a2e422f3378d93c30eded"}, + {file = "tree_sitter_html-0.23.2-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4bdaa7ac5030d416aea0c512d4810ef847bbbd62d61e3d213f370b64ce147293"}, + {file = "tree_sitter_html-0.23.2-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:d2e9631b66041a4fd792d7f79a0c4128adb3bfc71f3dcb7e1a3eab5dbee77d67"}, + {file = "tree_sitter_html-0.23.2-cp39-abi3-win_amd64.whl", hash = "sha256:85095f49f9e57f0ac9087a3e830783352c8447fdda55b1c1139aa47e5eaa0e21"}, + {file = "tree_sitter_html-0.23.2-cp39-abi3-win_arm64.whl", hash = "sha256:0f65ed9e877144d0f04ade5644e5b0e88bf98a9e60bce65235c99905623e2f1a"}, + {file = "tree_sitter_html-0.23.2.tar.gz", hash = "sha256:bc9922defe23144d9146bc1509fcd00d361bf6b3303f9effee6532c6a0296961"}, +] + +[package.extras] +core = ["tree-sitter (>=0.22,<1.0)"] + +[[package]] +name = "tree-sitter-java" +version = "0.23.4" +description = "Java grammar for tree-sitter" +optional = true +python-versions = ">=3.9" +files = [ + {file = "tree_sitter_java-0.23.4-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:91cf4507a64529737639941e82d901891edb33e594daced2d75de829ac50962f"}, + {file = "tree_sitter_java-0.23.4-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:3f74e9c2f01b4c511cdf99e5a947642f37e8d621804d65ec7858a321bdcb1ba6"}, + {file = "tree_sitter_java-0.23.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:874d489bffc8c418a48f899ae75d3b774b999013840b6591f60b882ff03f9aa3"}, + {file = "tree_sitter_java-0.23.4-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:79107666639d6a531565fbf6f4a00a06df1589c61101b832f5315f1969899184"}, + {file = "tree_sitter_java-0.23.4-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:ff8aaccedaf484db9be41ddf1c44cdc4805556f0607de29c22300f14db693616"}, + {file = "tree_sitter_java-0.23.4-cp39-abi3-win_amd64.whl", hash = "sha256:e7477ffd19e0d0121e340fd7320efe028d2ae04784ffe13bec9a189cdeff0744"}, + {file = "tree_sitter_java-0.23.4-cp39-abi3-win_arm64.whl", hash = "sha256:c7688f1b004bdf390e7c0bf05384485866086675bf24caf4b2781353552b48a1"}, + {file = "tree_sitter_java-0.23.4.tar.gz", hash = "sha256:611857a92a232143ee20a4eb7cb46d6ff212b2d21cc7e3377b2943282c16a366"}, +] + +[package.extras] +core = ["tree-sitter (>=0.22,<1.0)"] + +[[package]] +name = "tree-sitter-javascript" +version = "0.23.1" +description = "JavaScript grammar for tree-sitter" +optional = true +python-versions = ">=3.9" +files = [ + {file = "tree_sitter_javascript-0.23.1-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:6ca583dad4bd79d3053c310b9f7208cd597fd85f9947e4ab2294658bb5c11e35"}, + {file = "tree_sitter_javascript-0.23.1-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:94100e491a6a247aa4d14caf61230c171b6376c863039b6d9cd71255c2d815ec"}, + {file = "tree_sitter_javascript-0.23.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5a6bc1055b061c5055ec58f39ee9b2e9efb8e6e0ae970838af74da0afb811f0a"}, + {file = "tree_sitter_javascript-0.23.1-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:056dc04fb6b24293f8c5fec43c14e7e16ba2075b3009c643abf8c85edc4c7c3c"}, + {file = "tree_sitter_javascript-0.23.1-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a11ca1c0f736da42967586b568dff8a465ee148a986c15ebdc9382806e0ce871"}, + {file = "tree_sitter_javascript-0.23.1-cp39-abi3-win_amd64.whl", hash = "sha256:041fa22b34250ea6eb313d33104d5303f79504cb259d374d691e38bbdc49145b"}, + {file = "tree_sitter_javascript-0.23.1-cp39-abi3-win_arm64.whl", hash = "sha256:eb28130cd2fb30d702d614cbf61ef44d1c7f6869e7d864a9cc17111e370be8f7"}, + {file = "tree_sitter_javascript-0.23.1.tar.gz", hash = "sha256:b2059ce8b150162cda05a457ca3920450adbf915119c04b8c67b5241cd7fcfed"}, +] + +[package.extras] +core = ["tree-sitter (>=0.22,<1.0)"] + +[[package]] +name = "tree-sitter-json" +version = "0.24.8" +description = "JSON grammar for tree-sitter" +optional = true +python-versions = ">=3.9" +files = [ + {file = "tree_sitter_json-0.24.8-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:59ac06c6db1877d0e2076bce54a5fddcdd2fc38ca778905662e80fa9ffcea2ab"}, + {file = "tree_sitter_json-0.24.8-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:62b4c45b561db31436a81a3f037f71ec29049f4fc9bf5269b6ec3ebaaa35a1cd"}, + {file = "tree_sitter_json-0.24.8-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f8627f7d375fda9fc193ebee368c453f374f65c2f25c58b6fea4e6b49a7fccbc"}, + {file = "tree_sitter_json-0.24.8-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:85cca779872f7278f3a74eb38533d34b9c4de4fd548615e3361fa64fe350ad0a"}, + {file = "tree_sitter_json-0.24.8-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:deeb45850dcc52990fbb52c80196492a099e3fa3512d928a390a91cf061068cc"}, + {file = "tree_sitter_json-0.24.8-cp39-abi3-win_amd64.whl", hash = "sha256:e4849a03cd7197267b2688a4506a90a13568a8e0e8588080bd0212fcb38974e3"}, + {file = "tree_sitter_json-0.24.8-cp39-abi3-win_arm64.whl", hash = "sha256:591e0096c882d12668b88f30d3ca6f85b9db3406910eaaab6afb6b17d65367dd"}, + {file = "tree_sitter_json-0.24.8.tar.gz", hash = "sha256:ca8486e52e2d261819311d35cf98656123d59008c3b7dcf91e61d2c0c6f3120e"}, +] + +[package.extras] +core = ["tree-sitter (>=0.22,<1.0)"] + +[[package]] +name = "tree-sitter-markdown" +version = "0.3.2" +description = "Markdown grammar for tree-sitter" +optional = true +python-versions = ">=3.9" +files = [ + {file = "tree_sitter_markdown-0.3.2-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:2a0d60ee5185fbc20c6f3e7744348956a62f8bc9ae85b574251632e3c2220c77"}, + {file = "tree_sitter_markdown-0.3.2-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:0a72f199966380e18f668abb3e9d0a75569c8a292967deefc432282e253f9f84"}, + {file = "tree_sitter_markdown-0.3.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3555e5732223b030c8b5742fb565b4528566d96700ea7de9a2902e51fb91be21"}, + {file = "tree_sitter_markdown-0.3.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d7fd68cbbccd917067696952773a553ef4d604017d9332b7a6f6a05549f1c0a3"}, + {file = "tree_sitter_markdown-0.3.2-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:a693f0251f13fa925631fdc9e30f2435f5569d1b3b3d2c3d3b24060d3234f98a"}, + {file = "tree_sitter_markdown-0.3.2-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:507b9d99500dcbeefb069815b689c3dd36892375e878669f98125d0cd0a814a4"}, + {file = "tree_sitter_markdown-0.3.2-cp39-abi3-win_amd64.whl", hash = "sha256:a89a374920d648599d07036e0ec979f54fde684ddaee1bddf406339c51565cbc"}, + {file = "tree_sitter_markdown-0.3.2-cp39-abi3-win_arm64.whl", hash = "sha256:017e7c09c44861f35a4499564ecd0d97a25341905dc9d0dec2e6a38ee4e6b52d"}, + {file = "tree_sitter_markdown-0.3.2.tar.gz", hash = "sha256:64501234ae4ce5429551624e2fd675008cf86824bd8b9352223653e39218e753"}, +] + +[package.extras] +core = ["tree-sitter (>=0.23,<1.0)"] + +[[package]] +name = "tree-sitter-python" +version = "0.23.4" +description = "Python grammar for tree-sitter" +optional = true +python-versions = ">=3.9" +files = [ + {file = "tree_sitter_python-0.23.4-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:188d70f36190cee62808b614de6ecc20e5e79f7c44a2653f41056fddae6bb003"}, + {file = "tree_sitter_python-0.23.4-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:a84227000c5d5e8ebc4ba5eb5ef9f7b92c7db5cfca02da593c2f41891a607333"}, + {file = "tree_sitter_python-0.23.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3cbeaa9424a61794b98cefa6e364395ed529c39f3c0c65fda5f71a8974dd8e2c"}, + {file = "tree_sitter_python-0.23.4-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3735b77a07975a00a142431ecf16ad0de4033b8398ff23954c227a68603caf84"}, + {file = "tree_sitter_python-0.23.4-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:7570eaf258bb1a6399aa56ee2679f1d48a156477e77660220c02fddd4af588ce"}, + {file = "tree_sitter_python-0.23.4-cp39-abi3-win_amd64.whl", hash = "sha256:785e4ac3d5e34e8012b26ea9baef7ab80f8d31703d3511e901064c4deac02cd4"}, + {file = "tree_sitter_python-0.23.4-cp39-abi3-win_arm64.whl", hash = "sha256:8acbd1345c57a3e10add8bb21713ea07eae25595b9d38c7e7034c542962851f9"}, + {file = "tree_sitter_python-0.23.4.tar.gz", hash = "sha256:da1752137c86a3ba42e646367fbc939df61fb1b48de239a74e1e5e0b1b7f163e"}, +] + +[package.extras] +core = ["tree-sitter (>=0.22,<1.0)"] + +[[package]] +name = "tree-sitter-regex" +version = "0.24.3" +description = "Regex grammar for tree-sitter" +optional = true +python-versions = ">=3.9" +files = [ + {file = "tree_sitter_regex-0.24.3-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:16ded552d0f43dda608cec078b4a63f1dfa53c793775ba1a1bb06b2539b94fff"}, + {file = "tree_sitter_regex-0.24.3-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:0a26bf77f7a8aa070299246eb3a29276030481ff380346c4085a97e448c34570"}, + {file = "tree_sitter_regex-0.24.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6abbf0708dbef6d70444bf9482528b39bae255ce59ed147dd1a731127e49a8da"}, + {file = "tree_sitter_regex-0.24.3-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cdb7134e1c954a18c321053f753da1c5aea9dc6d92e814796d34d03c4b76c012"}, + {file = "tree_sitter_regex-0.24.3-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:bf21ff69b8356d83b19ece6468ffe855d397eeeee1e34e8a11de0dc2be5ee896"}, + {file = "tree_sitter_regex-0.24.3-cp39-abi3-win_amd64.whl", hash = "sha256:7cb8f173054859a3d8b8f111833c638b1f1fef878fafb191e6974bbcaf5e930f"}, + {file = "tree_sitter_regex-0.24.3-cp39-abi3-win_arm64.whl", hash = "sha256:2eb9001e9ccb97d3d608e07f524335b0e5614abf67a004004c6c90abf0feb7cf"}, + {file = "tree_sitter_regex-0.24.3.tar.gz", hash = "sha256:58bb63f9e0ff01430da56ff158bddcb1b62a31f115abdf93cc6af76cc3aff86e"}, +] + +[package.extras] +core = ["tree-sitter (>=0.22,<1.0)"] + +[[package]] +name = "tree-sitter-rust" +version = "0.23.2" +description = "Rust grammar for tree-sitter" +optional = true +python-versions = ">=3.9" +files = [ + {file = "tree_sitter_rust-0.23.2-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:b6b26a4c07ddc243f3701450ff34093b8e3b08f14d269db2d049c625d151677c"}, + {file = "tree_sitter_rust-0.23.2-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:c6224f608df559d75425e5ef428f635b9fb87d7aa8716444915ee67ec6955085"}, + {file = "tree_sitter_rust-0.23.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:deced590a85ce848cda56f33728bad93b95827c1e3c736b707b24fb4280b3788"}, + {file = "tree_sitter_rust-0.23.2-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:540cf826932fe7cfd800361e368617e138c3d7914fad3b90786b7505af216be6"}, + {file = "tree_sitter_rust-0.23.2-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:880be40b220e87105b60db48c57cdd8019b5039b324afb1d643fa9c2fc187873"}, + {file = "tree_sitter_rust-0.23.2-cp39-abi3-win_amd64.whl", hash = "sha256:d8e0bea4fd76fc8b325247f3d1bb3dc2707db7dd3818b02c251efdea1b47909c"}, + {file = "tree_sitter_rust-0.23.2-cp39-abi3-win_arm64.whl", hash = "sha256:3ea49daa887ad59230758e7a96432193af4a2c7183781e1e85c35d4f8cb30b6b"}, + {file = "tree_sitter_rust-0.23.2.tar.gz", hash = "sha256:9088a0e0342d3de2749088811f5561994423cb10dab5ad3251003dffaa0a1bd1"}, +] + +[package.extras] +core = ["tree-sitter (>=0.22,<1.0)"] + +[[package]] +name = "tree-sitter-sql" +version = "0.3.7" +description = "Tree-sitter Grammar for SQL" +optional = true +python-versions = ">=3.9" +files = [ + {file = "tree_sitter_sql-0.3.7-cp38-abi3-macosx_10_9_x86_64.whl", hash = "sha256:f3f8427328bd8b4ee02ab50d71bfc515937c037b8a03dcf54b8c98403d804269"}, + {file = "tree_sitter_sql-0.3.7-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:97ad55611f7d777b08a30d60150e1c44100ac2759a341b1cf1ffa2f97f20259e"}, + {file = "tree_sitter_sql-0.3.7-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:aa7beae1c2e841edc6de5a80d3ee6d401b579d9d27ce9553f2c569bef4b95b8f"}, + {file = "tree_sitter_sql-0.3.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b5fc2daa8fc8d49265327ddaff0b5bbda5a6a0e37d05b157fdbcb2530f1e96e8"}, + {file = "tree_sitter_sql-0.3.7-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:5f3c34121b625ee8f43e6ccffaca5205b206afa31592aedd1f078b4f6f4cb321"}, + {file = "tree_sitter_sql-0.3.7-cp38-abi3-win_amd64.whl", hash = "sha256:09e4af2b4c32b09e602c83f1e584e5f390901fce929fa7c3da2ddf416e30681e"}, + {file = "tree_sitter_sql-0.3.7-cp38-abi3-win_arm64.whl", hash = "sha256:e7b09235e5492ac8f71abaeb078e28dbfa94881998a5fbf22c659da49165054c"}, + {file = "tree_sitter_sql-0.3.7.tar.gz", hash = "sha256:5eb671ad597e6245d96aa44fd584c990d3eaffe80faddf941bfe8ebee6a8e2dd"}, +] + +[package.extras] +core = ["tree-sitter (>=0.22,<1.0)"] + +[[package]] +name = "tree-sitter-toml" +version = "0.7.0" +description = "TOML grammar for tree-sitter" +optional = true +python-versions = ">=3.9" +files = [ + {file = "tree_sitter_toml-0.7.0-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:b9ae5c3e7c5b6bb05299dd73452ceafa7fa0687d5af3012332afa7757653b676"}, + {file = "tree_sitter_toml-0.7.0-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:18be09538e9775cddc0290392c4e2739de2201260af361473ca60b5c21f7bd22"}, + {file = "tree_sitter_toml-0.7.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a045e0acfcf91b7065066f7e51ea038ed7385c1e35e7e8fae18f252d3f8adb8c"}, + {file = "tree_sitter_toml-0.7.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7a2f8cf9d73f07b6628093b35e5c5fbac039247e32cb075eaa5289a5914e73af"}, + {file = "tree_sitter_toml-0.7.0-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:860ffa4513b2dc3083d8e412bd815a350b0a9490624b37e7c8f6ed5c6f9ce63c"}, + {file = "tree_sitter_toml-0.7.0-cp39-abi3-win_amd64.whl", hash = "sha256:2760a04f06937b01b1562a2135cd7e8207e399e73ef75bbebc77e37b1ad3b15d"}, + {file = "tree_sitter_toml-0.7.0-cp39-abi3-win_arm64.whl", hash = "sha256:fd00fd8a51c65aa19c40539431cb1773d87c30af5757b4041fa6c229058420b4"}, + {file = "tree_sitter_toml-0.7.0.tar.gz", hash = "sha256:29e257612fa8f0c1fcbc4e7e08ddc561169f1725265302e64d81086354144a70"}, +] + +[package.extras] +core = ["tree-sitter (>=0.22,<1.0)"] + +[[package]] +name = "tree-sitter-xml" +version = "0.7.0" +description = "XML & DTD grammars for tree-sitter" +optional = true +python-versions = ">=3.9" +files = [ + {file = "tree_sitter_xml-0.7.0-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:cc3e516d4c1e0860fb22172c172148debb825ba638971bc48bad15b22e5b0bae"}, + {file = "tree_sitter_xml-0.7.0-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:0674fdf4cc386e4d323cb287d3b072663de0f20a9e9af5d5e09821aae56a9e5c"}, + {file = "tree_sitter_xml-0.7.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8c0fe5f2d6cc09974c8375c8ea9b24909f493b5bf04aacdc4c694b5d2ae6b040"}, + {file = "tree_sitter_xml-0.7.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd3209516a4d84dff90bc91d2ad2ce246de8504cede4358849687fa8e71536e7"}, + {file = "tree_sitter_xml-0.7.0-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:87578e15fa55f44ecd9f331233b6f8a2cbde3546b354c830ecb862a632379455"}, + {file = "tree_sitter_xml-0.7.0-cp39-abi3-win_amd64.whl", hash = "sha256:9ba2dafc6ce9feaf4ccc617d3aeea57f8e0ca05edad34953e788001ebff79133"}, + {file = "tree_sitter_xml-0.7.0-cp39-abi3-win_arm64.whl", hash = "sha256:fc759f710a8fd7a01c23e2d7cb013679199045bea3dc0e5151650a11322aaf40"}, + {file = "tree_sitter_xml-0.7.0.tar.gz", hash = "sha256:ab0ff396f20230ad8483d968151ce0c35abe193eb023b20fbd8b8ce4cf9e9f61"}, +] + +[package.extras] +core = ["tree-sitter (>=0.22,<1.0)"] + +[[package]] +name = "tree-sitter-yaml" +version = "0.6.0" +description = "YAML grammar for tree-sitter" +optional = true python-versions = ">=3.8" files = [ - {file = "types-tree-sitter-languages-1.10.0.20240612.tar.gz", hash = "sha256:e9e4e53e8a94cf1438051e85c92e0fb20470c6ec702a6faa424a9bb2022fb5cc"}, - {file = "types_tree_sitter_languages-1.10.0.20240612-py3-none-any.whl", hash = "sha256:5d654de047f7e5f7e66fa39ae0bf13f78f981e74dda2afd4a9d178a3b1dc3fc4"}, + {file = "tree_sitter_yaml-0.6.0-cp38-abi3-macosx_10_9_x86_64.whl", hash = "sha256:62d53ef380d6f0ae731818be4e236d3006abede6331d1b727fe6a5476601cff9"}, + {file = "tree_sitter_yaml-0.6.0-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:7e7ccc5666336dabf3bfbffd6333c3df7ab8c8b6564fd550fe443d4a09609f57"}, + {file = "tree_sitter_yaml-0.6.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b0b5c0a4db1834e8066fe011f6a9e9a7dbd03eb70321a59c74b079dd6ca8389e"}, + {file = "tree_sitter_yaml-0.6.0-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:41ea2cc2857982c4e2102032fadf186d9c8d5b53706f5963c5470234eac39fc4"}, + {file = "tree_sitter_yaml-0.6.0-cp38-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:c07c297e515af4c11912d32ad8115261c1999570f6cee0af96850ed9daacda6d"}, + {file = "tree_sitter_yaml-0.6.0-cp38-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:f20b99ee3b11c7307d80698ac71a3c9b1284760cd205d6575e796e0285a172a7"}, + {file = "tree_sitter_yaml-0.6.0-cp38-abi3-win_amd64.whl", hash = "sha256:5cd6a603303c3c3a8f1e79245d202fb1156baff48000c7a01de085767eba9253"}, ] -[package.dependencies] -tree-sitter = ">=0.20.3" +[package.extras] +core = ["tree-sitter (>=0.21,<1.0)"] + +[[package]] +name = "types-setuptools" +version = "67.8.0.0" +description = "Typing stubs for setuptools" +optional = false +python-versions = "*" +files = [ + {file = "types-setuptools-67.8.0.0.tar.gz", hash = "sha256:95c9ed61871d6c0e258433373a4e1753c0a7c3627a46f4d4058c7b5a08ab844f"}, + {file = "types_setuptools-67.8.0.0-py3-none-any.whl", hash = "sha256:6df73340d96b238a4188b7b7668814b37e8018168aef1eef94a3b1872e3f60ff"}, +] [[package]] name = "typing-extensions" @@ -2706,9 +2856,9 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", type = ["pytest-mypy"] [extras] -syntax = ["tree-sitter", "tree-sitter-languages"] +syntax = ["tree-sitter", "tree-sitter-bash", "tree-sitter-css", "tree-sitter-go", "tree-sitter-html", "tree-sitter-java", "tree-sitter-javascript", "tree-sitter-json", "tree-sitter-markdown", "tree-sitter-python", "tree-sitter-regex", "tree-sitter-rust", "tree-sitter-sql", "tree-sitter-toml", "tree-sitter-xml", "tree-sitter-yaml"] [metadata] lock-version = "2.0" python-versions = "^3.8.1" -content-hash = "09b9b9d2fe3b6c3cf95d6a255bcde4e2f3b6236e15f4e9b576210310e89c02dd" +content-hash = "b7254181f587a82218bd72f76a3bd12cc70e39e2cca8c144689905e5a0f58353" diff --git a/pyproject.toml b/pyproject.toml index 2049b84fb7..f7da768e58 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,12 +46,48 @@ markdown-it-py = { extras = ["plugins", "linkify"], version = ">=2.1.0" } rich = ">=13.3.3" #rich = {path="../rich", develop=true} typing-extensions = "^4.4.0" -tree-sitter = { version = "^0.20.1", optional = true } -tree-sitter-languages = { version = "1.10.2", optional = true } platformdirs = ">=3.6.0,<5" +# start of [syntax] extras +# Require tree-sitter >= 0.23.0 and python >= 3.9 +# Windows, MacOS and Linux binary wheels are available for all of the languages below. +tree-sitter = { version = ">=0.23.0", optional = true, python = ">=3.9" } +tree-sitter-python = { version = ">=0.23.0", optional = true, python = ">=3.9" } +tree-sitter-markdown = { version = ">=0.3.0", optional = true, python = ">=3.9"} +tree-sitter-json = { version = ">=0.24.0", optional = true, python = ">=3.9" } +tree-sitter-toml = { version = ">=0.6.0", optional = true, python = ">=3.9" } +tree-sitter-yaml = { version = ">=0.6.0", optional = true, python = ">=3.9" } +tree-sitter-html = { version = ">=0.23.0", optional = true, python = ">=3.9" } +tree-sitter-css = { version = ">=0.23.0", optional = true, python = ">=3.9" } +tree-sitter-javascript = { version = ">=0.23.0", optional = true, python = ">=3.9" } +tree-sitter-rust = { version = ">=0.23.0", optional = true, python = ">=3.9" } +tree-sitter-go = { version = ">=0.23.0", optional = true, python = ">=3.9" } +tree-sitter-regex = { version = ">=0.24.0", optional = true, python = ">=3.9" } +tree-sitter-xml = { version = ">=0.7.0", optional = true, python = ">=3.9" } +tree-sitter-sql = { version = ">=0.3.0", optional = true, python = ">=3.9" } +tree-sitter-java = { version = ">=0.23.0", optional = true, python = ">=3.9" } +tree-sitter-bash = { version = ">=0.23.0", optional = true, python = ">=3.9" } +# end of [syntax] extras + [tool.poetry.extras] -syntax = ["tree-sitter", "tree_sitter_languages"] +syntax = [ + "tree-sitter", + "tree-sitter-python", + "tree-sitter-markdown", + "tree-sitter-json", + "tree-sitter-toml", + "tree-sitter-yaml", + "tree-sitter-html", + "tree-sitter-css", + "tree-sitter-javascript", + "tree-sitter-rust", + "tree-sitter-go", + "tree-sitter-regex", + "tree-sitter-xml", + "tree-sitter-sql", + "tree-sitter-java", + "tree-sitter-bash", +] [tool.poetry.group.dev.dependencies] black = "24.4.2" @@ -72,8 +108,6 @@ pytest-asyncio = "*" pytest-cov = "^5.0.0" textual-dev = "^1.7.0" types-setuptools = "^67.2.0.1" -types-tree-sitter = "^0.20.1.4" -types-tree-sitter-languages = "^1.7.0.1" isort = "^5.13.2" pytest-textual-snapshot = "^1.0.0" diff --git a/src/textual/_text_area_theme.py b/src/textual/_text_area_theme.py index e315716f30..0585bf81b2 100644 --- a/src/textual/_text_area_theme.py +++ b/src/textual/_text_area_theme.py @@ -148,7 +148,7 @@ def apply_css(self, text_area: TextArea) -> None: self.selection_style = selection_style else: selection_background_color = background_color.blend( - app_theme.primary, factor=0.75 + app_theme.primary, factor=0.5 ) self.selection_style = Style.from_color( bgcolor=selection_background_color.rich_color @@ -204,8 +204,9 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "string": Style(color="#E6DB74"), "string.documentation": Style(color="#E6DB74"), "comment": Style(color="#75715E"), + "heading.marker": Style(color="#90908a"), "keyword": Style(color="#F92672"), - "operator": Style(color="#F92672"), + "operator": Style(color="#f8f8f2"), "repeat": Style(color="#F92672"), "exception": Style(color="#F92672"), "include": Style(color="#F92672"), @@ -216,7 +217,10 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "number": Style(color="#AE81FF"), "float": Style(color="#AE81FF"), "class": Style(color="#A6E22E"), + "type": Style(color="#A6E22E"), "type.class": Style(color="#A6E22E"), + "type.builtin": Style(color="#F92672"), + "variable.builtin": Style(color="#f8f8f2"), "function": Style(color="#A6E22E"), "function.call": Style(color="#A6E22E"), "method": Style(color="#A6E22E"), @@ -232,12 +236,18 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "json.label": Style(color="#F92672", bold=True), "toml.type": Style(color="#F92672"), "toml.datetime": Style(color="#AE81FF"), + "css.property": Style(color="#AE81FF"), "heading": Style(color="#F92672", bold=True), "bold": Style(bold=True), "italic": Style(italic=True), "strikethrough": Style(strike=True), - "link": Style(color="#66D9EF", underline=True), + "link.label": Style(color="#F92672"), + "link.uri": Style(color="#66D9EF", underline=True), + "list.marker": Style(color="#90908a"), "inline_code": Style(color="#E6DB74"), + "punctuation.bracket": Style(color="#f8f8f2"), + "punctuation.delimiter": Style(color="#f8f8f2"), + "punctuation.special": Style(color="#f8f8f2"), }, ) @@ -254,8 +264,9 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "string": Style(color="#f1fa8c"), "string.documentation": Style(color="#f1fa8c"), "comment": Style(color="#6272a4"), + "heading.marker": Style(color="#6272a4"), "keyword": Style(color="#ff79c6"), - "operator": Style(color="#ff79c6"), + "operator": Style(color="#f8f8f2"), "repeat": Style(color="#ff79c6"), "exception": Style(color="#ff79c6"), "include": Style(color="#ff79c6"), @@ -266,12 +277,15 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "number": Style(color="#bd93f9"), "float": Style(color="#bd93f9"), "class": Style(color="#50fa7b"), + "type": Style(color="#ff79c6"), "type.class": Style(color="#50fa7b"), + "type.builtin": Style(color="#bd93f9"), + "variable.builtin": Style(color="#f8f8f2"), "function": Style(color="#50fa7b"), "function.call": Style(color="#50fa7b"), "method": Style(color="#50fa7b"), "method.call": Style(color="#50fa7b"), - "boolean": Style(color="#bd93f9"), + "boolean": Style(color="#50fa7b"), "constant.builtin": Style(color="#bd93f9"), "json.null": Style(color="#bd93f9"), "regex.punctuation.bracket": Style(color="#ff79c6"), @@ -282,12 +296,18 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "json.label": Style(color="#ff79c6", bold=True), "toml.type": Style(color="#ff79c6"), "toml.datetime": Style(color="#bd93f9"), + "css.property": Style(color="#bd93f9"), "heading": Style(color="#ff79c6", bold=True), "bold": Style(bold=True), "italic": Style(italic=True), "strikethrough": Style(strike=True), - "link": Style(color="#bd93f9", underline=True), + "link.label": Style(color="#ff79c6"), + "link.uri": Style(color="#bd93f9", underline=True), + "list.marker": Style(color="#6272a4"), "inline_code": Style(color="#f1fa8c"), + "punctuation.bracket": Style(color="#f8f8f2"), + "punctuation.delimiter": Style(color="#f8f8f2"), + "punctuation.special": Style(color="#f8f8f2"), }, ) @@ -304,8 +324,9 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "string": Style(color="#ce9178"), "string.documentation": Style(color="#ce9178"), "comment": Style(color="#6A9955"), - "keyword": Style(color="#569cd6"), - "operator": Style(color="#569cd6"), + "heading.marker": Style(color="#6E7681"), + "keyword": Style(color="#C586C0"), + "operator": Style(color="#CCCCCC"), "conditional": Style(color="#569cd6"), "keyword.function": Style(color="#569cd6"), "keyword.return": Style(color="#569cd6"), @@ -316,11 +337,14 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "number": Style(color="#b5cea8"), "float": Style(color="#b5cea8"), "class": Style(color="#4EC9B0"), + "type": Style(color="#EFCB43"), "type.class": Style(color="#4EC9B0"), - "function": Style(color="#4EC9B0"), - "function.call": Style(color="#4EC9B0"), + "type.builtin": Style(color="#9CDCFE"), + "function": Style(color="#DCDCAA"), + "function.call": Style(color="#DCDCAA"), "method": Style(color="#4EC9B0"), "method.call": Style(color="#4EC9B0"), + "constructor": Style(color="#4EC9B0"), "boolean": Style(color="#7DAF9C"), "constant.builtin": Style(color="#7DAF9C"), "json.null": Style(color="#7DAF9C"), @@ -328,13 +352,20 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "yaml.field": Style(color="#569cd6", bold=True), "json.label": Style(color="#569cd6", bold=True), "toml.type": Style(color="#569cd6"), + "toml.datetime": Style(color="#C586C0", italic=True), + "css.property": Style(color="#569cd6"), "heading": Style(color="#569cd6", bold=True), "bold": Style(bold=True), "italic": Style(italic=True), "strikethrough": Style(strike=True), - "link": Style(color="#40A6FF", underline=True), + "link.uri": Style(color="#40A6FF", underline=True), + "link.label": Style(color="#569cd6"), + "list.marker": Style(color="#6E7681"), "inline_code": Style(color="#ce9178"), "info_string": Style(color="#ce9178", bold=True, italic=True), + "punctuation.bracket": Style(color="#CCCCCC"), + "punctuation.delimiter": Style(color="#CCCCCC"), + "punctuation.special": Style(color="#CCCCCC"), }, ) @@ -351,6 +382,10 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "string": Style(color="#093069"), "string.documentation": Style(color="#093069"), "comment": Style(color="#6a737d"), + "heading.marker": Style(color="#A4A4A4"), + "type": Style(color="#A4A4A4"), + "type.class": Style(color="#A4A4A4"), + "type.builtin": Style(color="#7DAF9C"), "keyword": Style(color="#d73a49"), "operator": Style(color="#0450AE"), "conditional": Style(color="#CF222E"), @@ -373,12 +408,18 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "yaml.field": Style(color="#6639BB"), "json.label": Style(color="#6639BB"), "toml.type": Style(color="#6639BB"), + "css.property": Style(color="#6639BB"), "heading": Style(color="#24292e", bold=True), "bold": Style(bold=True), "italic": Style(italic=True), "strikethrough": Style(strike=True), - "link": Style(color="#40A6FF", underline=True), + "link.uri": Style(color="#40A6FF", underline=True), + "link.label": Style(color="#6639BB"), + "list.marker": Style(color="#A4A4A4"), "inline_code": Style(color="#093069"), + "punctuation.bracket": Style(color="#24292e"), + "punctuation.delimiter": Style(color="#24292e"), + "punctuation.special": Style(color="#24292e"), }, ) diff --git a/src/textual/_tree_sitter.py b/src/textual/_tree_sitter.py index 01e300115c..193bf16fd4 100644 --- a/src/textual/_tree_sitter.py +++ b/src/textual/_tree_sitter.py @@ -1,10 +1,49 @@ from __future__ import annotations try: - from tree_sitter import Language, Parser, Tree - from tree_sitter.binding import Query - from tree_sitter_languages import get_language, get_parser + import tree_sitter_bash + import tree_sitter_css + import tree_sitter_go + import tree_sitter_html + import tree_sitter_java + import tree_sitter_javascript + import tree_sitter_json + import tree_sitter_markdown + import tree_sitter_python + import tree_sitter_regex + import tree_sitter_rust + import tree_sitter_sql + import tree_sitter_toml + import tree_sitter_xml + import tree_sitter_yaml + from tree_sitter import Language + + _tree_sitter = True + + _languages = { + "python": Language(tree_sitter_python.language()), + "json": Language(tree_sitter_json.language()), + "markdown": Language(tree_sitter_markdown.language()), + "yaml": Language(tree_sitter_yaml.language()), + "toml": Language(tree_sitter_toml.language()), + "rust": Language(tree_sitter_rust.language()), + "html": Language(tree_sitter_html.language()), + "css": Language(tree_sitter_css.language()), + "xml": Language(tree_sitter_xml.language_xml()), + "regex": Language(tree_sitter_regex.language()), + "sql": Language(tree_sitter_sql.language()), + "javascript": Language(tree_sitter_javascript.language()), + "java": Language(tree_sitter_java.language()), + "bash": Language(tree_sitter_bash.language()), + "go": Language(tree_sitter_go.language()), + } + + def get_language(language_name: str) -> Language | None: + return _languages.get(language_name) - TREE_SITTER = True except ImportError: - TREE_SITTER = False + _tree_sitter = False + _languages = {} + +TREE_SITTER = _tree_sitter +BUILTIN_LANGUAGES: dict[str, "Language"] = _languages diff --git a/src/textual/demo/widgets.py b/src/textual/demo/widgets.py index fe7eaf8eff..16eb437a36 100644 --- a/src/textual/demo/widgets.py +++ b/src/textual/demo/widgets.py @@ -731,7 +731,6 @@ def compose(self) -> ComposeResult: "Java", "Javascript", "JSON", - "Kotlin", "Markdown", "Python", "Rust", diff --git a/src/textual/document/_document.py b/src/textual/document/_document.py index 386a6a7713..47e87eb09b 100644 --- a/src/textual/document/_document.py +++ b/src/textual/document/_document.py @@ -8,8 +8,7 @@ from typing_extensions import Literal, get_args if TYPE_CHECKING: - from tree_sitter import Node - from tree_sitter.binding import Query + from tree_sitter import Node, Query from textual._cells import cell_len from textual.geometry import Size @@ -143,10 +142,10 @@ def get_size(self, indent_width: int) -> Size: def query_syntax_tree( self, - query: Query, + query: "Query", start_point: tuple[int, int] | None = None, end_point: tuple[int, int] | None = None, - ) -> list[tuple[Node, str]]: + ) -> dict[str, list["Node"]]: """Query the tree-sitter syntax tree. The default implementation always returns an empty list. @@ -159,11 +158,11 @@ def query_syntax_tree( end_point: The (row, column byte) to end the query at. Returns: - A tuple containing the nodes and text captured by the query. + A dict mapping captured node names to lists of Nodes with that name. """ - return [] + return {} - def prepare_query(self, query: str) -> Query | None: + def prepare_query(self, query: str) -> "Query | None": return None @property @@ -206,7 +205,7 @@ class Document(DocumentBase): """A document which can be opened in a TextArea.""" def __init__(self, text: str) -> None: - self._newline = _detect_newline_style(text) + self._newline: Newline = _detect_newline_style(text) """The type of newline used in the text.""" self._lines: list[str] = text.splitlines(keepends=False) """The lines of the document, excluding newline characters. @@ -371,14 +370,23 @@ def get_index_from_location(self, location: Location) -> int: return index def get_location_from_index(self, index: int) -> Location: - """Given an index in the document's text, returns the corresponding location. + """Given a codepoint index in the document's text, returns the corresponding location. Args: index: The index in the document's text. Returns: The corresponding location. + + Raises: + ValueError: If the index is doesn't correspond to a location in the document. """ + error_message = ( + f"Index {index!r} does not correspond to a location in the document." + ) + if index < 0 or index > len(self.text): + raise ValueError(error_message) + column_index = 0 newline_length = len(self.newline) for line_index in range(self.line_count): @@ -391,6 +399,8 @@ def get_location_from_index(self, index: int) -> Location: return (line_index + 1, 0) column_index = next_column_index + raise ValueError(error_message) + def get_line(self, index: int) -> str: """Returns the line with the given index from the document. diff --git a/src/textual/document/_languages.py b/src/textual/document/_languages.py deleted file mode 100644 index fb313cf7ca..0000000000 --- a/src/textual/document/_languages.py +++ /dev/null @@ -1,19 +0,0 @@ -BUILTIN_LANGUAGES = sorted( - [ - "bash", - "css", - "go", - "html", - "java", - "javascript", - "json", - "kotlin", - "markdown", - "python", - "rust", - "regex", - "sql", - "toml", - "yaml", - ] -) diff --git a/src/textual/document/_syntax_aware_document.py b/src/textual/document/_syntax_aware_document.py index 32dbc191b3..162d3fbd54 100644 --- a/src/textual/document/_syntax_aware_document.py +++ b/src/textual/document/_syntax_aware_document.py @@ -1,16 +1,15 @@ from __future__ import annotations try: - from tree_sitter import Language, Node, Parser, Tree - from tree_sitter.binding import Query - from tree_sitter_languages import get_language, get_parser + from tree_sitter import Language, Node, Parser, Query, Tree TREE_SITTER = True except ImportError: TREE_SITTER = False + +from textual._tree_sitter import BUILTIN_LANGUAGES from textual.document._document import Document, EditResult, Location, _utf8_encode -from textual.document._languages import BUILTIN_LANGUAGES class SyntaxAwareDocumentError(Exception): @@ -52,7 +51,8 @@ def __init__( """The tree-sitter Language or None if tree-sitter is unavailable.""" self._parser: Parser | None = None - """The tree-sitter Parser or None if tree-sitter is unavailable.""" + + from textual._tree_sitter import get_language # If the language is `None`, then avoid doing any parsing related stuff. if isinstance(language, str): @@ -61,25 +61,22 @@ def __init__( # If tree-sitter-languages is not installed properly, get_language # and get_parser may raise an OSError when unable to load their # resources + try: self.language = get_language(language) - self._parser = get_parser(language) except OSError as e: raise SyntaxAwareDocumentError( f"Could not find binaries for {language!r}" ) from e else: self.language = language - self._parser = Parser() - self._parser.set_language(language) + + self._parser = Parser(self.language) + """The tree-sitter Parser or None if tree-sitter is unavailable.""" self._syntax_tree: Tree = self._parser.parse(self._read_callable) # type: ignore """The tree-sitter Tree (syntax tree) built from the document.""" - @property - def language_name(self) -> str | None: - return self.language.name if self.language else None - def prepare_query(self, query: str) -> Query | None: """Prepare a tree-sitter tree query. @@ -110,7 +107,7 @@ def query_syntax_tree( query: Query, start_point: tuple[int, int] | None = None, end_point: tuple[int, int] | None = None, - ) -> list[tuple["Node", str]]: + ) -> dict[str, list["Node"]]: """Query the tree-sitter syntax tree. The default implementation always returns an empty list. @@ -176,12 +173,13 @@ def replace_range(self, start: Location, end: Location, text: str) -> EditResult ) # Incrementally parse the document. self._syntax_tree = self._parser.parse( - self._read_callable, self._syntax_tree # type: ignore[arg-type] + self._read_callable, + self._syntax_tree, # type: ignore[arg-type] ) return replace_result - def get_line(self, line_index: int) -> str: + def get_line(self, index: int) -> str: """Return the string representing the line, not including new line characters. Args: @@ -190,7 +188,7 @@ def get_line(self, line_index: int) -> str: Returns: The string representing the line. """ - line_string = self[line_index] + line_string = self[index] return line_string def _location_to_byte_offset(self, location: Location) -> int: diff --git a/src/textual/tree-sitter/highlights/css.scm b/src/textual/tree-sitter/highlights/css.scm index b26f0ec96c..19b0fbfdeb 100644 --- a/src/textual/tree-sitter/highlights/css.scm +++ b/src/textual/tree-sitter/highlights/css.scm @@ -52,7 +52,7 @@ (property_name) (feature_name) (attribute_name) - ] @property + ] @css.property (namespace_name) @namespace diff --git a/src/textual/tree-sitter/highlights/javascript.scm b/src/textual/tree-sitter/highlights/javascript.scm index 613a49a86f..9312d68288 100644 --- a/src/textual/tree-sitter/highlights/javascript.scm +++ b/src/textual/tree-sitter/highlights/javascript.scm @@ -1,29 +1,17 @@ -; Special identifiers -;-------------------- - -([ - (identifier) - (shorthand_property_identifier) - (shorthand_property_identifier_pattern) - ] @constant - (#match? @constant "^[A-Z_][A-Z\\d_]+$")) - +; Variables +;---------- -((identifier) @constructor - (#match? @constructor "^[A-Z]")) +(identifier) @variable -((identifier) @variable.builtin - (#match? @variable.builtin "^(arguments|module|console|window|document)$") - (#is-not? local)) +; Properties +;----------- -((identifier) @function.builtin - (#eq? @function.builtin "require") - (#is-not? local)) +(property_identifier) @property ; Function and method definitions ;-------------------------------- -(function +(function_expression name: (identifier) @function) (function_declaration name: (identifier) @function) @@ -32,20 +20,20 @@ (pair key: (property_identifier) @function.method - value: [(function) (arrow_function)]) + value: [(function_expression) (arrow_function)]) (assignment_expression left: (member_expression property: (property_identifier) @function.method) - right: [(function) (arrow_function)]) + right: [(function_expression) (arrow_function)]) (variable_declarator name: (identifier) @function - value: [(function) (arrow_function)]) + value: [(function_expression) (arrow_function)]) (assignment_expression left: (identifier) @function - right: [(function) (arrow_function)]) + right: [(function_expression) (arrow_function)]) ; Function and method calls ;-------------------------- @@ -57,15 +45,26 @@ function: (member_expression property: (property_identifier) @function.method)) -; Variables -;---------- +; Special identifiers +;-------------------- -(identifier) @variable +((identifier) @constructor + (#match? @constructor "^[A-Z]")) -; Properties -;----------- +([ + (identifier) + (shorthand_property_identifier) + (shorthand_property_identifier_pattern) + ] @constant + (#match? @constant "^[A-Z_][A-Z\\d_]+$")) -(property_identifier) @property +((identifier) @variable.builtin + (#match? @variable.builtin "^(arguments|module|console|window|document)$") + (#is-not? local)) + +((identifier) @function.builtin + (#eq? @function.builtin "require") + (#is-not? local)) ; Literals ;--------- @@ -93,10 +92,6 @@ ; Tokens ;------- -(template_substitution - "${" @punctuation.special - "}" @punctuation.special) @embedded - [ ";" (optional_chain) @@ -160,6 +155,10 @@ "}" ] @punctuation.bracket +(template_substitution + "${" @punctuation.special + "}" @punctuation.special) @embedded + [ "as" "async" diff --git a/src/textual/tree-sitter/highlights/kotlin.scm b/src/textual/tree-sitter/highlights/kotlin.scm deleted file mode 100644 index d2e15a68ee..0000000000 --- a/src/textual/tree-sitter/highlights/kotlin.scm +++ /dev/null @@ -1,380 +0,0 @@ -;; Based on the nvim-treesitter highlighting, which is under the Apache license. -;; See https://github.com/nvim-treesitter/nvim-treesitter/blob/f8ab59861eed4a1c168505e3433462ed800f2bae/queries/kotlin/highlights.scm -;; -;; The only difference in this file is that queries using #lua-match? -;; have been removed. - -;;; Identifiers - -(simple_identifier) @variable - -; `it` keyword inside lambdas -; FIXME: This will highlight the keyword outside of lambdas since tree-sitter -; does not allow us to check for arbitrary nestation -((simple_identifier) @variable.builtin -(#eq? @variable.builtin "it")) - -; `field` keyword inside property getter/setter -; FIXME: This will highlight the keyword outside of getters and setters -; since tree-sitter does not allow us to check for arbitrary nestation -((simple_identifier) @variable.builtin -(#eq? @variable.builtin "field")) - -; `this` this keyword inside classes -(this_expression) @variable.builtin - -; `super` keyword inside classes -(super_expression) @variable.builtin - -(class_parameter - (simple_identifier) @property) - -(class_body - (property_declaration - (variable_declaration - (simple_identifier) @property))) - -; id_1.id_2.id_3: `id_2` and `id_3` are assumed as object properties -(_ - (navigation_suffix - (simple_identifier) @property)) - -(enum_entry - (simple_identifier) @constant) - -(type_identifier) @type - -((type_identifier) @type.builtin - (#any-of? @type.builtin - "Byte" - "Short" - "Int" - "Long" - "UByte" - "UShort" - "UInt" - "ULong" - "Float" - "Double" - "Boolean" - "Char" - "String" - "Array" - "ByteArray" - "ShortArray" - "IntArray" - "LongArray" - "UByteArray" - "UShortArray" - "UIntArray" - "ULongArray" - "FloatArray" - "DoubleArray" - "BooleanArray" - "CharArray" - "Map" - "Set" - "List" - "EmptyMap" - "EmptySet" - "EmptyList" - "MutableMap" - "MutableSet" - "MutableList" -)) - -(package_header - . (identifier)) @namespace - -(import_header - "import" @include) - - -; TODO: Seperate labeled returns/breaks/continue/super/this -; Must be implemented in the parser first -(label) @label - -;;; Function definitions - -(function_declaration - . (simple_identifier) @function) - -(getter - ("get") @function.builtin) -(setter - ("set") @function.builtin) - -(primary_constructor) @constructor -(secondary_constructor - ("constructor") @constructor) - -(constructor_invocation - (user_type - (type_identifier) @constructor)) - -(anonymous_initializer - ("init") @constructor) - -(parameter - (simple_identifier) @parameter) - -(parameter_with_optional_type - (simple_identifier) @parameter) - -; lambda parameters -(lambda_literal - (lambda_parameters - (variable_declaration - (simple_identifier) @parameter))) - -;;; Function calls - -; function() -(call_expression - . (simple_identifier) @function) - -; object.function() or object.property.function() -(call_expression - (navigation_expression - (navigation_suffix - (simple_identifier) @function) . )) - -(call_expression - . (simple_identifier) @function.builtin - (#any-of? @function.builtin - "arrayOf" - "arrayOfNulls" - "byteArrayOf" - "shortArrayOf" - "intArrayOf" - "longArrayOf" - "ubyteArrayOf" - "ushortArrayOf" - "uintArrayOf" - "ulongArrayOf" - "floatArrayOf" - "doubleArrayOf" - "booleanArrayOf" - "charArrayOf" - "emptyArray" - "mapOf" - "setOf" - "listOf" - "emptyMap" - "emptySet" - "emptyList" - "mutableMapOf" - "mutableSetOf" - "mutableListOf" - "print" - "println" - "error" - "TODO" - "run" - "runCatching" - "repeat" - "lazy" - "lazyOf" - "enumValues" - "enumValueOf" - "assert" - "check" - "checkNotNull" - "require" - "requireNotNull" - "with" - "suspend" - "synchronized" -)) - -;;; Literals - -[ - (line_comment) - (multiline_comment) - (shebang_line) -] @comment - -(real_literal) @float -[ - (integer_literal) - (long_literal) - (hex_literal) - (bin_literal) - (unsigned_literal) -] @number - -[ - "null" ; should be highlighted the same as booleans - (boolean_literal) -] @boolean - -(character_literal) @character - -(string_literal) @string - -(character_escape_seq) @string.escape - -; There are 3 ways to define a regex -; - "[abc]?".toRegex() -(call_expression - (navigation_expression - ((string_literal) @string.regex) - (navigation_suffix - ((simple_identifier) @_function - (#eq? @_function "toRegex"))))) - -; - Regex("[abc]?") -(call_expression - ((simple_identifier) @_function - (#eq? @_function "Regex")) - (call_suffix - (value_arguments - (value_argument - (string_literal) @string.regex)))) - -; - Regex.fromLiteral("[abc]?") -(call_expression - (navigation_expression - ((simple_identifier) @_class - (#eq? @_class "Regex")) - (navigation_suffix - ((simple_identifier) @_function - (#eq? @_function "fromLiteral")))) - (call_suffix - (value_arguments - (value_argument - (string_literal) @string.regex)))) - -;;; Keywords - -(type_alias "typealias" @keyword) -[ - (class_modifier) - (member_modifier) - (function_modifier) - (property_modifier) - (platform_modifier) - (variance_modifier) - (parameter_modifier) - (visibility_modifier) - (reification_modifier) - (inheritance_modifier) -]@keyword - -[ - "val" - "var" - "enum" - "class" - "object" - "interface" -; "typeof" ; NOTE: It is reserved for future use -] @keyword - -("fun") @keyword.function - -(jump_expression) @keyword.return - -[ - "if" - "else" - "when" -] @conditional - -[ - "for" - "do" - "while" -] @repeat - -[ - "try" - "catch" - "throw" - "finally" -] @exception - - -(annotation - "@" @attribute (use_site_target)? @attribute) -(annotation - (user_type - (type_identifier) @attribute)) -(annotation - (constructor_invocation - (user_type - (type_identifier) @attribute))) - -(file_annotation - "@" @attribute "file" @attribute ":" @attribute) -(file_annotation - (user_type - (type_identifier) @attribute)) -(file_annotation - (constructor_invocation - (user_type - (type_identifier) @attribute))) - -;;; Operators & Punctuation - -[ - "!" - "!=" - "!==" - "=" - "==" - "===" - ">" - ">=" - "<" - "<=" - "||" - "&&" - "+" - "++" - "+=" - "-" - "--" - "-=" - "*" - "*=" - "/" - "/=" - "%" - "%=" - "?." - "?:" - "!!" - "is" - "!is" - "in" - "!in" - "as" - "as?" - ".." - "->" -] @operator - -[ - "(" ")" - "[" "]" - "{" "}" -] @punctuation.bracket - -[ - "." - "," - ";" - ":" - "::" -] @punctuation.delimiter - -; NOTE: `interpolated_identifier`s can be highlighted in any way -(string_literal - "$" @punctuation.special - (interpolated_identifier) @none) -(string_literal - "${" @punctuation.special - (interpolated_expression) @none - "}" @punctuation.special) diff --git a/src/textual/tree-sitter/highlights/markdown.scm b/src/textual/tree-sitter/highlights/markdown.scm index 1d6691bcfc..563c5138f5 100644 --- a/src/textual/tree-sitter/highlights/markdown.scm +++ b/src/textual/tree-sitter/highlights/markdown.scm @@ -1,9 +1,51 @@ -(heading_content) @heading -(list_marker) @comment -(strong_emphasis) @bold -(emphasis) @italic -(strikethrough) @strikethrough -(link) @link -(code_span) @inline_code -(info_string) @info_string -(fenced_code_block) @fenced_code_block +(atx_heading (inline) @heading) +(setext_heading (paragraph) @heading) + +[ + (atx_h1_marker) + (atx_h2_marker) + (atx_h3_marker) + (atx_h4_marker) + (atx_h5_marker) + (atx_h6_marker) + (setext_h1_underline) + (setext_h2_underline) +] @heading.marker + +[ + (link_title) + (indented_code_block) + (fenced_code_block) +] @text.literal + +[ + (fenced_code_block_delimiter) +] @punctuation.delimiter + +(code_fence_content) @none + +[ + (link_destination) +] @link.uri + +[ + (link_label) +] @link.label + +[ + (list_marker_plus) + (list_marker_minus) + (list_marker_star) + (list_marker_dot) + (list_marker_parenthesis) + (thematic_break) +] @list.marker + +[ + (block_continuation) + (block_quote_marker) +] @punctuation.special + +[ + (backslash_escape) +] @string.escape diff --git a/src/textual/tree-sitter/highlights/sql.scm b/src/textual/tree-sitter/highlights/sql.scm index 03a15fe381..fe4913026c 100644 --- a/src/textual/tree-sitter/highlights/sql.scm +++ b/src/textual/tree-sitter/highlights/sql.scm @@ -1,114 +1,444 @@ -(string) @string -(number) @number -(comment) @comment +(object_reference + name: (identifier) @type) -(function_call - function: (identifier) @function) +(invocation + (object_reference + name: (identifier) @function.call)) [ - (NULL) - (TRUE) - (FALSE) -] @constant.builtin - -([ - (type_cast - (type (identifier) @type.builtin)) - (create_function_statement - (type (identifier) @type.builtin)) - (create_function_statement - (create_function_parameters - (create_function_parameter (type (identifier) @type.builtin)))) - (create_type_statement - (type_spec_composite (type (identifier) @type.builtin))) - (create_table_statement - (table_parameters - (table_column (type (identifier) @type.builtin)))) - ] - (#match? - @type.builtin - "^(bigint|BIGINT|int8|INT8|bigserial|BIGSERIAL|serial8|SERIAL8|bit|BIT|varbit|VARBIT|boolean|BOOLEAN|bool|BOOL|box|BOX|bytea|BYTEA|character|CHARACTER|char|CHAR|varchar|VARCHAR|cidr|CIDR|circle|CIRCLE|date|DATE|float8|FLOAT8|inet|INET|integer|INTEGER|int|INT|int4|INT4|interval|INTERVAL|json|JSON|jsonb|JSONB|line|LINE|lseg|LSEG|macaddr|MACADDR|money|MONEY|numeric|NUMERIC|decimal|DECIMAL|path|PATH|pg_lsn|PG_LSN|point|POINT|polygon|POLYGON|real|REAL|float4|FLOAT4|smallint|SMALLINT|int2|INT2|smallserial|SMALLSERIAL|serial2|SERIAL2|serial|SERIAL|serial4|SERIAL4|text|TEXT|time|TIME|time|TIME|timestamp|TIMESTAMP|tsquery|TSQUERY|tsvector|TSVECTOR|txid_snapshot|TXID_SNAPSHOT|enum|ENUM|range|RANGE)$")) - -(identifier) @variable + (keyword_gist) + (keyword_btree) + (keyword_hash) + (keyword_spgist) + (keyword_gin) + (keyword_brin) + (keyword_array) +] @function.call + +(relation + alias: (identifier) @variable) + +(field + name: (identifier) @field) + +(term + alias: (identifier) @variable) + +((term + value: (cast + name: (keyword_cast) @function.call + parameter: [(literal)]?))) + +(comment) @comment @spell +(marginalia) @comment + +((literal) @number + (#match? @number "^[-+]?%d+$")) + +((literal) @float + (#match? @float "^[-+]?%d*\.%d*$")) + +(literal) @string + +(parameter) @parameter + +[ + (keyword_true) + (keyword_false) +] @boolean + +[ + (keyword_asc) + (keyword_desc) + (keyword_terminated) + (keyword_escaped) + (keyword_unsigned) + (keyword_nulls) + (keyword_last) + (keyword_delimited) + (keyword_replication) + (keyword_auto_increment) + (keyword_default) + (keyword_collate) + (keyword_concurrently) + (keyword_engine) + (keyword_always) + (keyword_generated) + (keyword_preceding) + (keyword_following) + (keyword_first) + (keyword_current_timestamp) + (keyword_immutable) + (keyword_atomic) + (keyword_parallel) + (keyword_leakproof) + (keyword_safe) + (keyword_cost) + (keyword_strict) +] @attribute + +[ + (keyword_materialized) + (keyword_recursive) + (keyword_temp) + (keyword_temporary) + (keyword_unlogged) + (keyword_external) + (keyword_parquet) + (keyword_csv) + (keyword_rcfile) + (keyword_textfile) + (keyword_orc) + (keyword_avro) + (keyword_jsonfile) + (keyword_sequencefile) + (keyword_volatile) +] @storageclass + +[ + (keyword_case) + (keyword_when) + (keyword_then) + (keyword_else) +] @conditional + +[ + (keyword_select) + (keyword_from) + (keyword_where) + (keyword_index) + (keyword_join) + (keyword_primary) + (keyword_delete) + (keyword_create) + (keyword_show) + (keyword_insert) + (keyword_merge) + (keyword_distinct) + (keyword_replace) + (keyword_update) + (keyword_into) + (keyword_overwrite) + (keyword_matched) + (keyword_values) + (keyword_value) + (keyword_attribute) + (keyword_set) + (keyword_left) + (keyword_right) + (keyword_outer) + (keyword_inner) + (keyword_full) + (keyword_order) + (keyword_partition) + (keyword_group) + (keyword_with) + (keyword_without) + (keyword_as) + (keyword_having) + (keyword_limit) + (keyword_offset) + (keyword_table) + (keyword_tables) + (keyword_key) + (keyword_references) + (keyword_foreign) + (keyword_constraint) + (keyword_force) + (keyword_use) + (keyword_for) + (keyword_if) + (keyword_exists) + (keyword_column) + (keyword_columns) + (keyword_cross) + (keyword_lateral) + (keyword_natural) + (keyword_alter) + (keyword_drop) + (keyword_add) + (keyword_view) + (keyword_end) + (keyword_is) + (keyword_using) + (keyword_between) + (keyword_window) + (keyword_no) + (keyword_data) + (keyword_type) + (keyword_rename) + (keyword_to) + (keyword_schema) + (keyword_owner) + (keyword_authorization) + (keyword_all) + (keyword_any) + (keyword_some) + (keyword_returning) + (keyword_begin) + (keyword_commit) + (keyword_rollback) + (keyword_transaction) + (keyword_only) + (keyword_like) + (keyword_similar) + (keyword_over) + (keyword_change) + (keyword_modify) + (keyword_after) + (keyword_before) + (keyword_range) + (keyword_rows) + (keyword_groups) + (keyword_exclude) + (keyword_current) + (keyword_ties) + (keyword_others) + (keyword_zerofill) + (keyword_format) + (keyword_fields) + (keyword_row) + (keyword_sort) + (keyword_compute) + (keyword_comment) + (keyword_location) + (keyword_cached) + (keyword_uncached) + (keyword_lines) + (keyword_stored) + (keyword_virtual) + (keyword_partitioned) + (keyword_analyze) + (keyword_explain) + (keyword_verbose) + (keyword_truncate) + (keyword_rewrite) + (keyword_optimize) + (keyword_vacuum) + (keyword_cache) + (keyword_language) + (keyword_called) + (keyword_conflict) + (keyword_declare) + (keyword_filter) + (keyword_function) + (keyword_input) + (keyword_name) + (keyword_oid) + (keyword_oids) + (keyword_precision) + (keyword_regclass) + (keyword_regnamespace) + (keyword_regproc) + (keyword_regtype) + (keyword_restricted) + (keyword_return) + (keyword_returns) + (keyword_separator) + (keyword_setof) + (keyword_stable) + (keyword_support) + (keyword_tblproperties) + (keyword_trigger) + (keyword_unsafe) + (keyword_admin) + (keyword_connection) + (keyword_cycle) + (keyword_database) + (keyword_encrypted) + (keyword_increment) + (keyword_logged) + (keyword_none) + (keyword_owned) + (keyword_password) + (keyword_reset) + (keyword_role) + (keyword_sequence) + (keyword_start) + (keyword_restart) + (keyword_tablespace) + (keyword_until) + (keyword_user) + (keyword_valid) + (keyword_action) + (keyword_definer) + (keyword_invoker) + (keyword_security) + (keyword_extension) + (keyword_version) + (keyword_out) + (keyword_inout) + (keyword_variadic) + (keyword_ordinality) + (keyword_session) + (keyword_isolation) + (keyword_level) + (keyword_serializable) + (keyword_repeatable) + (keyword_read) + (keyword_write) + (keyword_committed) + (keyword_uncommitted) + (keyword_deferrable) + (keyword_names) + (keyword_zone) + (keyword_immediate) + (keyword_deferred) + (keyword_constraints) + (keyword_snapshot) + (keyword_characteristics) + (keyword_off) + (keyword_follows) + (keyword_precedes) + (keyword_each) + (keyword_instead) + (keyword_of) + (keyword_initially) + (keyword_old) + (keyword_new) + (keyword_referencing) + (keyword_statement) + (keyword_execute) + (keyword_procedure) + (keyword_copy) + (keyword_delimiter) + (keyword_encoding) + (keyword_escape) + (keyword_force_not_null) + (keyword_force_null) + (keyword_force_quote) + (keyword_freeze) + (keyword_header) + (keyword_match) + (keyword_program) + (keyword_quote) + (keyword_stdin) + (keyword_extended) + (keyword_main) + (keyword_plain) + (keyword_storage) + (keyword_compression) + (keyword_duplicate) +] @keyword [ - "::" + (keyword_restrict) + (keyword_unbounded) + (keyword_unique) + (keyword_cascade) + (keyword_delayed) + (keyword_high_priority) + (keyword_low_priority) + (keyword_ignore) + (keyword_nothing) + (keyword_check) + (keyword_option) + (keyword_local) + (keyword_cascaded) + (keyword_wait) + (keyword_nowait) + (keyword_metadata) + (keyword_incremental) + (keyword_bin_pack) + (keyword_noscan) + (keyword_stats) + (keyword_statistics) + (keyword_maxvalue) + (keyword_minvalue) +] @type.qualifier + +[ + (keyword_int) + (keyword_null) + (keyword_boolean) + (keyword_binary) + (keyword_varbinary) + (keyword_image) + (keyword_bit) + (keyword_inet) + (keyword_character) + (keyword_smallserial) + (keyword_serial) + (keyword_bigserial) + (keyword_smallint) + (keyword_mediumint) + (keyword_bigint) + (keyword_tinyint) + (keyword_decimal) + (keyword_float) + (keyword_double) + (keyword_numeric) + (keyword_real) + (double) + (keyword_money) + (keyword_smallmoney) + (keyword_char) + (keyword_nchar) + (keyword_varchar) + (keyword_nvarchar) + (keyword_varying) + (keyword_text) + (keyword_string) + (keyword_uuid) + (keyword_json) + (keyword_jsonb) + (keyword_xml) + (keyword_bytea) + (keyword_enum) + (keyword_date) + (keyword_datetime) + (keyword_time) + (keyword_datetime2) + (keyword_datetimeoffset) + (keyword_smalldatetime) + (keyword_timestamp) + (keyword_timestamptz) + (keyword_geometry) + (keyword_geography) + (keyword_box2d) + (keyword_box3d) + (keyword_interval) +] @type.builtin + +[ + (keyword_in) + (keyword_and) + (keyword_or) + (keyword_not) + (keyword_by) + (keyword_on) + (keyword_do) + (keyword_union) + (keyword_except) + (keyword_intersect) +] @keyword.operator + +[ + "+" + "-" + "*" + "/" + "%" + "^" + ":=" + "=" "<" "<=" - "<>" - "=" - ">" + "!=" ">=" + ">" + "<>" + (op_other) + (op_unary_other) ] @operator [ "(" ")" - "[" - "]" ] @punctuation.bracket [ ";" + "," "." ] @punctuation.delimiter - -[ - (type) - (array_type) -] @type - -[ - (primary_key_constraint) - (unique_constraint) - (null_constraint) -] @keyword - -[ - "AND" - "AS" - "AUTO_INCREMENT" - "CREATE" - "CREATE_DOMAIN" - "CREATE_OR_REPLACE_FUNCTION" - "CREATE_SCHEMA" - "TABLE" - "TEMPORARY" - "CREATE_TYPE" - "DATABASE" - "FROM" - "GRANT" - "GROUP_BY" - "IF_NOT_EXISTS" - "INDEX" - "INNER" - "INSERT" - "INTO" - "IN" - "JOIN" - "LANGUAGE" - "LEFT" - "LOCAL" - "NOT" - "ON" - "OR" - "ORDER_BY" - "OUTER" - "PRIMARY_KEY" - "PUBLIC" - "RETURNS" - "SCHEMA" - "SELECT" - "SESSION" - "SET" - "TABLE" - "TIME_ZONE" - "TO" - "UNIQUE" - "UPDATE" - "USAGE" - "VALUES" - "WHERE" - "WITH" - "WITHOUT" -] @keyword diff --git a/src/textual/tree-sitter/highlights/toml.scm b/src/textual/tree-sitter/highlights/toml.scm index 26e3982fef..58ba6eb2d3 100644 --- a/src/textual/tree-sitter/highlights/toml.scm +++ b/src/textual/tree-sitter/highlights/toml.scm @@ -24,7 +24,7 @@ "." @punctuation.delimiter "," @punctuation.delimiter -"=" @toml.operator +"=" @operator "[" @punctuation.bracket "]" @punctuation.bracket diff --git a/src/textual/tree-sitter/highlights/xml.scm b/src/textual/tree-sitter/highlights/xml.scm new file mode 100644 index 0000000000..9861eea178 --- /dev/null +++ b/src/textual/tree-sitter/highlights/xml.scm @@ -0,0 +1,168 @@ +;; XML declaration + +"xml" @keyword + +[ "version" "encoding" "standalone" ] @property + +(EncName) @string.special + +(VersionNum) @number + +[ "yes" "no" ] @boolean + +;; Processing instructions + +(PI) @embedded + +(PI (PITarget) @keyword) + +;; Element declaration + +(elementdecl + "ELEMENT" @keyword + (Name) @tag) + +(contentspec + (_ (Name) @property)) + +"#PCDATA" @type.builtin + +[ "EMPTY" "ANY" ] @string.special.symbol + +[ "*" "?" "+" ] @operator + +;; Entity declaration + +(GEDecl + "ENTITY" @keyword + (Name) @constant) + +(GEDecl (EntityValue) @string) + +(NDataDecl + "NDATA" @keyword + (Name) @label) + +;; Parsed entity declaration + +(PEDecl + "ENTITY" @keyword + "%" @operator + (Name) @constant) + +(PEDecl (EntityValue) @string) + +;; Notation declaration + +(NotationDecl + "NOTATION" @keyword + (Name) @constant) + +(NotationDecl + (ExternalID + (SystemLiteral (URI) @string.special))) + +;; Attlist declaration + +(AttlistDecl + "ATTLIST" @keyword + (Name) @tag) + +(AttDef (Name) @property) + +(AttDef (Enumeration (Nmtoken) @string)) + +(DefaultDecl (AttValue) @string) + +[ + (StringType) + (TokenizedType) +] @type.builtin + +(NotationType "NOTATION" @type.builtin) + +[ + "#REQUIRED" + "#IMPLIED" + "#FIXED" +] @attribute + +;; Entities + +(EntityRef) @constant + +((EntityRef) @constant.builtin + (#any-of? @constant.builtin + "&" "<" ">" """ "'")) + +(CharRef) @constant + +(PEReference) @constant + +;; External references + +[ "PUBLIC" "SYSTEM" ] @keyword + +(PubidLiteral) @string.special + +(SystemLiteral (URI) @markup.link) + +;; Processing instructions + +(XmlModelPI "xml-model" @keyword) + +(StyleSheetPI "xml-stylesheet" @keyword) + +(PseudoAtt (Name) @property) + +(PseudoAtt (PseudoAttValue) @string) + +;; Doctype declaration + +(doctypedecl "DOCTYPE" @keyword) + +(doctypedecl (Name) @type) + +;; Tags + +(STag (Name) @tag) + +(ETag (Name) @tag) + +(EmptyElemTag (Name) @tag) + +;; Attributes + +(Attribute (Name) @property) + +(Attribute (AttValue) @string) + +;; Delimiters & punctuation + +[ + "" + "" + "<" ">" + "" +] @punctuation.delimiter + +[ "(" ")" "[" "]" ] @punctuation.bracket + +[ "\"" "'" ] @punctuation.delimiter + +[ "," "|" "=" ] @operator + +;; Text + +(CharData) @markup + +(CDSect + (CDStart) @markup.heading + (CData) @markup.raw + "]]>" @markup.heading) + +;; Misc + +(Comment) @comment + +(ERROR) @error diff --git a/src/textual/widgets/_text_area.py b/src/textual/widgets/_text_area.py index 6540889c6f..e498210336 100644 --- a/src/textual/widgets/_text_area.py +++ b/src/textual/widgets/_text_area.py @@ -14,7 +14,7 @@ from typing_extensions import Literal from textual._text_area_theme import TextAreaTheme -from textual._tree_sitter import TREE_SITTER +from textual._tree_sitter import BUILTIN_LANGUAGES, TREE_SITTER from textual.color import Color from textual.document._document import ( Document, @@ -27,7 +27,6 @@ from textual.document._document_navigator import DocumentNavigator from textual.document._edit import Edit from textual.document._history import EditHistory -from textual.document._languages import BUILTIN_LANGUAGES from textual.document._syntax_aware_document import ( SyntaxAwareDocument, SyntaxAwareDocumentError, @@ -36,7 +35,7 @@ from textual.expand_tabs import expand_tabs_inline, expand_text_tabs_from_widths if TYPE_CHECKING: - from tree_sitter import Language + from tree_sitter import Language, Query from textual import events, log from textual._cells import cell_len, cell_width_to_column_index @@ -415,6 +414,13 @@ def __init__( self._languages: dict[str, TextAreaLanguage] = {} """Maps language names to TextAreaLanguage.""" + for language_name, language_object in BUILTIN_LANGUAGES.items(): + self._languages[language_name] = TextAreaLanguage( + language_name, + language_object, + self._get_builtin_highlight_query(language_name), + ) + self._themes: dict[str, TextAreaTheme] = {} """Maps theme names to TextAreaTheme.""" @@ -583,26 +589,28 @@ def _build_highlight_map(self) -> None: return captures = self.document.query_syntax_tree(self._highlight_query) - for capture in captures: - node, highlight_name = capture - node_start_row, node_start_column = node.start_point - node_end_row, node_end_column = node.end_point - - if node_start_row == node_end_row: - highlight = (node_start_column, node_end_column, highlight_name) - highlights[node_start_row].append(highlight) - else: - # Add the first line of the node range - highlights[node_start_row].append( - (node_start_column, None, highlight_name) - ) + for highlight_name, nodes in captures.items(): + for node in nodes: + node_start_row, node_start_column = node.start_point + node_end_row, node_end_column = node.end_point + + if node_start_row == node_end_row: + highlight = (node_start_column, node_end_column, highlight_name) + highlights[node_start_row].append(highlight) + else: + # Add the first line of the node range + highlights[node_start_row].append( + (node_start_column, None, highlight_name) + ) - # Add the middle lines - entire row of this node is highlighted - for node_row in range(node_start_row + 1, node_end_row): - highlights[node_row].append((0, None, highlight_name)) + # Add the middle lines - entire row of this node is highlighted + for node_row in range(node_start_row + 1, node_end_row): + highlights[node_row].append((0, None, highlight_name)) - # Add the last line of the node range - highlights[node_end_row].append((0, node_end_column, highlight_name)) + # Add the last line of the node range + highlights[node_end_row].append( + (0, node_end_column, highlight_name) + ) def _watch_has_focus(self, focus: bool) -> None: self._cursor_visible = focus @@ -721,6 +729,9 @@ def _validate_selection(self, selection: Selection) -> Selection: def _watch_language(self, language: str | None) -> None: """When the language is updated, update the type of document.""" + if not TREE_SITTER: + return + if language is not None and language not in self.available_languages: raise LanguageDoesNotExist( f"{language!r} is not a builtin language, or it has not been registered. " @@ -830,7 +841,8 @@ def available_languages(self) -> set[str]: def register_language( self, - language: "str | Language", + name: str, + language: "Language", highlight_query: str, ) -> None: """Register a language and corresponding highlight query. @@ -845,34 +857,29 @@ def register_language( Registering a language only registers it to this instance of `TextArea`. Args: - language: A string referring to a builtin language or a tree-sitter `Language` object. + name: The name of the language. + language: A tree-sitter `Language` object. highlight_query: The highlight query to use for syntax highlighting this language. """ - - # If tree-sitter is unavailable, do nothing. if not TREE_SITTER: return + self._languages[name] = TextAreaLanguage(name, language, highlight_query) - from tree_sitter_languages import get_language - - if isinstance(language, str): - language_name = language - language = get_language(language_name) - else: - language_name = language.name + def update_highlight_query(self, name: str, highlight_query: str) -> None: + """Update the highlight query for an already registered language. - # Update the custom languages. When changing the document, - # we should first look in here for a language specification. - # If nothing is found, then we can go to the builtin languages. - self._languages[language_name] = TextAreaLanguage( - name=language_name, - language=language, - highlight_query=highlight_query, - ) - # If we updated the currently set language, rebuild the highlights - # using the newly updated highlights query. - if language_name == self.language: - self._set_document(self.text, language_name) + Args: + name: The name of the language. + highlight_query: The highlight query to use for syntax highlighting this language. + """ + if name not in self._languages: + raise LanguageDoesNotExist( + f"{name!r} is not a registered language.\n" + f"To register a language, call `TextArea.register_language`." + ) + self._languages[name].highlight_query = highlight_query + if name == self.language: + self._set_document(self.text, name) def _set_document(self, text: str, language: str | None) -> None: """Construct and return an appropriate document. diff --git a/src/textual/widgets/text_area.py b/src/textual/widgets/text_area.py index 058f823542..1d4621a78b 100644 --- a/src/textual/widgets/text_area.py +++ b/src/textual/widgets/text_area.py @@ -1,4 +1,5 @@ from textual._text_area_theme import TextAreaTheme +from textual._tree_sitter import BUILTIN_LANGUAGES from textual.document._document import ( Document, DocumentBase, @@ -9,7 +10,6 @@ from textual.document._document_navigator import DocumentNavigator from textual.document._edit import Edit from textual.document._history import EditHistory -from textual.document._languages import BUILTIN_LANGUAGES from textual.document._syntax_aware_document import SyntaxAwareDocument from textual.document._wrapped_document import WrappedDocument from textual.widgets._text_area import ( diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[bash].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[bash].svg index d0b51e163b..fac1d695c7 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[bash].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[bash].svg @@ -19,457 +19,457 @@ font-weight: 700; } - .terminal-3926422747-matrix { + .terminal-1868575305-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-3926422747-title { + .terminal-1868575305-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-3926422747-r1 { fill: #121212 } -.terminal-3926422747-r2 { fill: #0178d4 } -.terminal-3926422747-r3 { fill: #c5c8c6 } -.terminal-3926422747-r4 { fill: #c2c2bf } -.terminal-3926422747-r5 { fill: #272822 } -.terminal-3926422747-r6 { fill: #75715e } -.terminal-3926422747-r7 { fill: #f8f8f2 } -.terminal-3926422747-r8 { fill: #90908a } -.terminal-3926422747-r9 { fill: #e6db74 } -.terminal-3926422747-r10 { fill: #a6e22e } -.terminal-3926422747-r11 { fill: #f92672 } + .terminal-1868575305-r1 { fill: #121212 } +.terminal-1868575305-r2 { fill: #0178d4 } +.terminal-1868575305-r3 { fill: #c5c8c6 } +.terminal-1868575305-r4 { fill: #c2c2bf } +.terminal-1868575305-r5 { fill: #272822 } +.terminal-1868575305-r6 { fill: #75715e } +.terminal-1868575305-r7 { fill: #f8f8f2 } +.terminal-1868575305-r8 { fill: #90908a } +.terminal-1868575305-r9 { fill: #e6db74 } +.terminal-1868575305-r10 { fill: #a6e22e } +.terminal-1868575305-r11 { fill: #f92672 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  1  #!/bin/bash -  2   -  3  # Variables -  4  name="John" -  5  age=30                                                                  -  6  is_student=true                                                         -  7   -  8  # Printing variables -  9  echo"Hello, $name! You are $age years old." - 10   - 11  # Conditional statements - 12  if [[ $age -ge 18 &&$is_student == true ]]; then - 13  echo"You are an adult student." - 14  elif [[ $age -ge 18 ]]; then - 15  echo"You are an adult." - 16  else - 17  echo"You are a minor." - 18  fi - 19   - 20  # Arrays - 21  numbers=(1 2 3 4 5)                                                     - 22  echo"Numbers: ${numbers[@]}" - 23   - 24  # Loops - 25  for num in"${numbers[@]}"do - 26  echo"Number: $num" - 27  done - 28   - 29  # Functions - 30  greet() {                                                               - 31    local name=$1                                                         - 32  echo"Hello, $name!" - 33  }                                                                       - 34  greet"Alice" - 35   - 36  # Command substitution - 37  current_date=$(date +%Y-%m-%d)                                          - 38  echo"Current date: $current_date" - 39   - 40  # File operations - 41  touch file.txt                                                          - 42  echo"Some content"> file.txt                                          - 43  cat file.txt                                                            - 44   - 45  # Conditionals with file checks - 46  if [[ -f file.txt ]]; then - 47  echo"file.txt exists." - 48  else - 49  echo"file.txt does not exist." - 50  fi - 51   - 52  # Case statement - 53  case$age in - 54    18)                                                                   - 55  echo"You are 18 years old." - 56      ;;                                                                  - 57    30)                                                                   - 58  echo"You are 30 years old." - 59      ;;                                                                  - 60    *)                                                                    - 61  echo"You are neither 18 nor 30 years old." - 62      ;;                                                                  - 63  esac - 64   - 65  # While loop - 66  counter=0                                                               - 67  while [[ $counter -lt 5 ]]; do - 68  echo"Counter: $counter" - 69    ((counter++))                                                         - 70  done - 71   - 72  # Until loop - 73  until [[ $counter -eq 0 ]]; do - 74  echo"Counter: $counter" - 75    ((counter--))                                                         - 76  done - 77   - 78  # Heredoc - 79  cat << EOF - 80  This is a heredoc.  - 81  It allows you to write multiple lines of text.  - 82  EOF  - 83   - 84  # Redirection - 85  ls> file_list.txt                                                      - 86  grep"file" file_list.txt > filtered_list.txt                           - 87   - 88  # Pipes - 89  cat file_list.txt |wc -l                                               - 90   - 91  # Arithmetic operations - 92  result=$((10 + 5))                                                      - 93  echo"Result: $result" - 94   - 95  # Exporting variables - 96  export DB_PASSWORD="secret" - 97   - 98  # Sourcing external files - 99  source config.sh                                                        -100   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  1  #!/bin/bash +  2   +  3  # Variables +  4  name="John" +  5  age=30                                                                  +  6  is_student=true                                                         +  7   +  8  # Printing variables +  9  echo"Hello, $name! You are $age years old." + 10   + 11  # Conditional statements + 12  if [[ $age -ge 18 && $is_student == true ]]; then + 13  echo"You are an adult student." + 14  elif [[ $age -ge 18 ]]; then + 15  echo"You are an adult." + 16  else + 17  echo"You are a minor." + 18  fi + 19   + 20  # Arrays + 21  numbers=(1 2 3 4 5)                                                     + 22  echo"Numbers: ${numbers[@]}" + 23   + 24  # Loops + 25  for num in"${numbers[@]}"do + 26  echo"Number: $num" + 27  done + 28   + 29  # Functions + 30  greet() {                                                               + 31    local name=$1                                                         + 32  echo"Hello, $name!" + 33  }                                                                       + 34  greet"Alice" + 35   + 36  # Command substitution + 37  current_date=$(date +%Y-%m-%d)                                          + 38  echo"Current date: $current_date" + 39   + 40  # File operations + 41  touch file.txt                                                          + 42  echo"Some content" > file.txt                                          + 43  cat file.txt                                                            + 44   + 45  # Conditionals with file checks + 46  if [[ -f file.txt ]]; then + 47  echo"file.txt exists." + 48  else + 49  echo"file.txt does not exist." + 50  fi + 51   + 52  # Case statement + 53  case $age in + 54    18)                                                                   + 55  echo"You are 18 years old." + 56      ;;                                                                  + 57    30)                                                                   + 58  echo"You are 30 years old." + 59      ;;                                                                  + 60    *)                                                                    + 61  echo"You are neither 18 nor 30 years old." + 62      ;;                                                                  + 63  esac + 64   + 65  # While loop + 66  counter=0                                                               + 67  while [[ $counter -lt 5 ]]; do + 68  echo"Counter: $counter" + 69    ((counter++))                                                         + 70  done + 71   + 72  # Until loop + 73  until [[ $counter -eq 0 ]]; do + 74  echo"Counter: $counter" + 75    ((counter--))                                                         + 76  done + 77   + 78  # Heredoc + 79  cat << EOF + 80  This is a heredoc.  + 81  It allows you to write multiple lines of text.  + 82  EOF  + 83   + 84  # Redirection + 85  ls > file_list.txt                                                      + 86  grep"file" file_list.txt > filtered_list.txt                           + 87   + 88  # Pipes + 89  cat file_list.txt | wc -l                                               + 90   + 91  # Arithmetic operations + 92  result=$((10 + 5))                                                      + 93  echo"Result: $result" + 94   + 95  # Exporting variables + 96  export DB_PASSWORD="secret" + 97   + 98  # Sourcing external files + 99  source config.sh                                                        +100   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[css].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[css].svg index 010338a190..44ac0c0411 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[css].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[css].svg @@ -19,330 +19,330 @@ font-weight: 700; } - .terminal-384858635-matrix { + .terminal-2526263208-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-384858635-title { + .terminal-2526263208-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-384858635-r1 { fill: #121212 } -.terminal-384858635-r2 { fill: #0178d4 } -.terminal-384858635-r3 { fill: #c5c8c6 } -.terminal-384858635-r4 { fill: #c2c2bf } -.terminal-384858635-r5 { fill: #272822 } -.terminal-384858635-r6 { fill: #75715e } -.terminal-384858635-r7 { fill: #f8f8f2 } -.terminal-384858635-r8 { fill: #90908a } -.terminal-384858635-r9 { fill: #e6db74 } -.terminal-384858635-r10 { fill: #ae81ff } -.terminal-384858635-r11 { fill: #f92672 } -.terminal-384858635-r12 { fill: #a6e22e } + .terminal-2526263208-r1 { fill: #121212 } +.terminal-2526263208-r2 { fill: #0178d4 } +.terminal-2526263208-r3 { fill: #c5c8c6 } +.terminal-2526263208-r4 { fill: #c2c2bf } +.terminal-2526263208-r5 { fill: #272822 } +.terminal-2526263208-r6 { fill: #75715e } +.terminal-2526263208-r7 { fill: #f8f8f2 } +.terminal-2526263208-r8 { fill: #90908a } +.terminal-2526263208-r9 { fill: #a6e22e } +.terminal-2526263208-r10 { fill: #ae81ff } +.terminal-2526263208-r11 { fill: #e6db74 } +.terminal-2526263208-r12 { fill: #f92672 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - 1  /* This is a comment in CSS */ - 2   - 3  /* Basic selectors and properties */ - 4  body {                                                                   - 5      font-family: Arial, sans-serif;                                      - 6      background-color: #f4f4f4;                                           - 7      margin: 0;                                                           - 8      padding: 0;                                                          - 9  }                                                                        -10   -11  /* Class and ID selectors */ -12  .header {                                                                -13      background-color: #333;                                              -14      color: #fff;                                                         -15      padding: 10px0;                                                     -16      text-align: center;                                                  -17  }                                                                        -18   -19  #logo {                                                                  -20      font-size: 24px;                                                     -21      font-weight: bold;                                                   -22  }                                                                        -23   -24  /* Descendant and child selectors */ -25  .nav ul {                                                                -26      list-style-type: none;                                               -27      padding: 0;                                                          -28  }                                                                        -29   -30  .nav > li {                                                              -31      display: inline-block;                                               -32      margin-right: 10px;                                                  -33  }                                                                        -34   -35  /* Pseudo-classes */ -36  a:hover {                                                                -37      text-decoration: underline;                                          -38  }                                                                        -39   -40  input:focus {                                                            -41      border-color: #007BFF;                                               -42  }                                                                        -43   -44  /* Media query */ -45  @media (max-width: 768px) {                                              -46      body {                                                               -47          font-size: 16px;                                                 -48      }                                                                    -49   -50      .header {                                                            -51          padding: 5px0;                                                  -52      }                                                                    -53  }                                                                        -54   -55  /* Keyframes animation */ -56  @keyframes slideIn {                                                     -57  from {                                                               -58          transform: translateX(-100%);                                    -59      }                                                                    -60  to {                                                                 -61          transform: translateX(0);                                        -62      }                                                                    -63  }                                                                        -64   -65  .slide-in-element {                                                      -66      animation: slideIn 0.5s forwards;                                    -67  }                                                                        -68   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + 1  /* This is a comment in CSS */ + 2   + 3  /* Basic selectors and properties */ + 4  body {                                                                   + 5  font-familyArialsans-serif;                                      + 6  background-color#f4f4f4;                                           + 7  margin0;                                                           + 8  padding0;                                                          + 9  }                                                                        +10   +11  /* Class and ID selectors */ +12  .header {                                                                +13  background-color#333;                                              +14  color#fff;                                                         +15  padding10px0;                                                     +16  text-aligncenter;                                                  +17  }                                                                        +18   +19  #logo {                                                                  +20  font-size24px;                                                     +21  font-weightbold;                                                   +22  }                                                                        +23   +24  /* Descendant and child selectors */ +25  .navul {                                                                +26  list-style-typenone;                                               +27  padding0;                                                          +28  }                                                                        +29   +30  .nav > li {                                                              +31  displayinline-block;                                               +32  margin-right10px;                                                  +33  }                                                                        +34   +35  /* Pseudo-classes */ +36  a:hover {                                                                +37  text-decorationunderline;                                          +38  }                                                                        +39   +40  input:focus {                                                            +41  border-color#007BFF;                                               +42  }                                                                        +43   +44  /* Media query */ +45  @media (max-width768px) {                                              +46  body {                                                               +47  font-size16px;                                                 +48      }                                                                    +49   +50      .header {                                                            +51  padding5px0;                                                  +52      }                                                                    +53  }                                                                        +54   +55  /* Keyframes animation */ +56  @keyframes slideIn {                                                     +57  from {                                                               +58  transformtranslateX(-100%);                                    +59      }                                                                    +60  to {                                                                 +61  transformtranslateX(0);                                        +62      }                                                                    +63  }                                                                        +64   +65  .slide-in-element {                                                      +66  animationslideIn0.5sforwards;                                    +67  }                                                                        +68   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[go].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[go].svg index fdf33ce885..9cf4d393b6 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[go].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[go].svg @@ -19,334 +19,334 @@ font-weight: 700; } - .terminal-2523768050-matrix { + .terminal-716815621-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2523768050-title { + .terminal-716815621-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2523768050-r1 { fill: #121212 } -.terminal-2523768050-r2 { fill: #0178d4 } -.terminal-2523768050-r3 { fill: #c5c8c6 } -.terminal-2523768050-r4 { fill: #c2c2bf } -.terminal-2523768050-r5 { fill: #272822 } -.terminal-2523768050-r6 { fill: #f92672 } -.terminal-2523768050-r7 { fill: #f8f8f2 } -.terminal-2523768050-r8 { fill: #90908a } -.terminal-2523768050-r9 { fill: #e6db74 } -.terminal-2523768050-r10 { fill: #ae81ff } -.terminal-2523768050-r11 { fill: #a6e22e } -.terminal-2523768050-r12 { fill: #66d9ef;font-style: italic; } + .terminal-716815621-r1 { fill: #121212 } +.terminal-716815621-r2 { fill: #0178d4 } +.terminal-716815621-r3 { fill: #c5c8c6 } +.terminal-716815621-r4 { fill: #c2c2bf } +.terminal-716815621-r5 { fill: #272822 } +.terminal-716815621-r6 { fill: #f92672 } +.terminal-716815621-r7 { fill: #f8f8f2 } +.terminal-716815621-r8 { fill: #90908a } +.terminal-716815621-r9 { fill: #e6db74 } +.terminal-716815621-r10 { fill: #ae81ff } +.terminal-716815621-r11 { fill: #a6e22e } +.terminal-716815621-r12 { fill: #66d9ef;font-style: italic; } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - 1  package main                                                             - 2   - 3  import (                                                                 - 4  "fmt" - 5  "math" - 6  "strings" - 7  )                                                                        - 8   - 9  const PI =3.14159 -10   -11  type Shape interface {                                                   -12      Area() float64                                                       -13  }                                                                        -14   -15  type Circle struct {                                                     -16      Radius float64                                                       -17  }                                                                        -18   -19  func (c Circle) Area() float64 {                                         -20  return PI * c.Radius * c.Radius                                      -21  }                                                                        -22   -23  funcmain() {                                                            -24  var name string ="John" -25      age :=30 -26      isStudent :=true -27   -28      fmt.Printf("Hello, %s! You are %d years old.", name, age)            -29   -30  if age >=18&& isStudent {                                          -31          fmt.Println("You are an adult student.")                         -32      } elseif age >=18 {                                                -33          fmt.Println("You are an adult.")                                 -34      } else {                                                             -35          fmt.Println("You are a minor.")                                  -36      }                                                                    -37   -38      numbers := []int{12345}                                      -39      sum :=0 -40  for _, num :=range numbers {                                        -41          sum += num                                                       -42      }                                                                    -43      fmt.Printf("The sum is: %d", sum)                                    -44   -45      message :="Hello, World!" -46      uppercaseMessage := strings.ToUpper(message)                         -47      fmt.Println(uppercaseMessage)                                        -48   -49      circle := Circle{Radius: 5}                                          -50      fmt.Printf("Circle area: %.2f", circle.Area())                       -51   -52      result :=factorial(5)                                               -53      fmt.Printf("Factorial of 5: %d", result)                             -54   -55  defer fmt.Println("Program finished.")                               -56   -57      sqrt :=func(x float64) float64 {                                    -58  return math.Sqrt(x)                                              -59      }                                                                    -60      fmt.Printf("Square root of 16: %.2f"sqrt(16))                      -61  }                                                                        -62   -63  funcfactorial(n int) int {                                              -64  if n ==0 {                                                          -65  return1 -66      }                                                                    -67  return n *factorial(n-1)                                            -68  }                                                                        -69   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + 1  package main                                                             + 2   + 3  import (                                                                 + 4  "fmt" + 5  "math" + 6  "strings" + 7  )                                                                        + 8   + 9  const PI = 3.14159 +10   +11  typeShapeinterface {                                                   +12      Area() float64 +13  }                                                                        +14   +15  typeCirclestruct {                                                     +16      Radius float64 +17  }                                                                        +18   +19  func (c Circle) Area() float64 {                                         +20  return PI * c.Radius * c.Radius                                      +21  }                                                                        +22   +23  funcmain() {                                                            +24  var name string = "John" +25      age := 30 +26      isStudent := true +27   +28      fmt.Printf("Hello, %s! You are %d years old.", name, age)            +29   +30  if age >= 18 && isStudent {                                          +31          fmt.Println("You are an adult student.")                         +32      } elseif age >= 18 {                                                +33          fmt.Println("You are an adult.")                                 +34      } else {                                                             +35          fmt.Println("You are a minor.")                                  +36      }                                                                    +37   +38      numbers := []int{12345}                                      +39      sum := 0 +40  for _, num := range numbers {                                        +41          sum += num                                                       +42      }                                                                    +43      fmt.Printf("The sum is: %d", sum)                                    +44   +45      message := "Hello, World!" +46      uppercaseMessage := strings.ToUpper(message)                         +47      fmt.Println(uppercaseMessage)                                        +48   +49      circle := Circle{Radius: 5}                                          +50      fmt.Printf("Circle area: %.2f", circle.Area())                       +51   +52      result := factorial(5)                                               +53      fmt.Printf("Factorial of 5: %d", result)                             +54   +55  defer fmt.Println("Program finished.")                               +56   +57      sqrt := func(x float64float64 {                                    +58  return math.Sqrt(x)                                              +59      }                                                                    +60      fmt.Printf("Square root of 16: %.2f"sqrt(16))                      +61  }                                                                        +62   +63  funcfactorial(n intint {                                              +64  if n == 0 {                                                          +65  return1 +66      }                                                                    +67  return n * factorial(n-1)                                            +68  }                                                                        +69   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[html].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[html].svg index 139014d905..3f1a3ee7c0 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[html].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[html].svg @@ -19,285 +19,285 @@ font-weight: 700; } - .terminal-597235610-matrix { + .terminal-118478681-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-597235610-title { + .terminal-118478681-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-597235610-r1 { fill: #121212 } -.terminal-597235610-r2 { fill: #0178d4 } -.terminal-597235610-r3 { fill: #c5c8c6 } -.terminal-597235610-r4 { fill: #c2c2bf } -.terminal-597235610-r5 { fill: #272822 } -.terminal-597235610-r6 { fill: #f8f8f2 } -.terminal-597235610-r7 { fill: #90908a } -.terminal-597235610-r8 { fill: #f92672 } -.terminal-597235610-r9 { fill: #e6db74 } -.terminal-597235610-r10 { fill: #75715e } -.terminal-597235610-r11 { fill: #003054 } + .terminal-118478681-r1 { fill: #121212 } +.terminal-118478681-r2 { fill: #0178d4 } +.terminal-118478681-r3 { fill: #c5c8c6 } +.terminal-118478681-r4 { fill: #c2c2bf } +.terminal-118478681-r5 { fill: #272822 } +.terminal-118478681-r6 { fill: #f8f8f2 } +.terminal-118478681-r7 { fill: #90908a } +.terminal-118478681-r8 { fill: #f92672 } +.terminal-118478681-r9 { fill: #e6db74 } +.terminal-118478681-r10 { fill: #75715e } +.terminal-118478681-r11 { fill: #003054 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - 1  <!DOCTYPE html>                                                          - 2  <html lang="en">                                                         - 3   - 4  <head>                                                                   - 5  <!-- Meta tags --> - 6      <meta charset="UTF-8">                                               - 7      <meta name="viewport" content="width=device-width, initial-scale=1.0 - 8  <!-- Title --> - 9      <title>HTML Test Page</title>                                        -10  <!-- Link to CSS --> -11      <link rel="stylesheet" href="styles.css">                            -12  </head>                                                                  -13   -14  <body>                                                                   -15  <!-- Header section --> -16      <header class="header">                                              -17          <h1 id="logo">HTML Test Page</h1>                                -18      </header>                                                            -19   -20  <!-- Navigation --> -21      <nav class="nav">                                                    -22          <ul>                                                             -23              <li><a href="#">Home</a></li>                                -24              <li><a href="#">About</a></li>                               -25              <li><a href="#">Contact</a></li>                             -26          </ul>                                                            -27      </nav>                                                               -28   -29  <!-- Main content area --> -30      <main>                                                               -31          <article>                                                        -32              <h2>Welcome to the Test Page</h2>                            -33              <p>This is a paragraph to test the HTML structure.</p>       -34              <img src="test-image.jpg" alt="Test Image" width="300">      -35          </article>                                                       -36      </main>                                                              -37   -38  <!-- Form --> -39      <section>                                                            -40          <form action="/submit" method="post">                            -41              <label for="name">Name:</label>                              -42              <input type="text" id="name" name="name">                    -43              <input type="submit" value="Submit">                         -44          </form>                                                          -45      </section>                                                           -46   -47  <!-- Footer --> -48      <footer>                                                             -49          <p>&copy; 2023 HTML Test Page</p>                                -50      </footer>                                                            -51   -52  <!-- Script tag --> -53      <script src="scripts.js"></script>                                   -54  </body>                                                                  -55   -56  </html>                                                                  -57   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + 1  <!DOCTYPE html>                                                          + 2  <html lang="en">                                                         + 3   + 4  <head>                                                                   + 5  <!-- Meta tags --> + 6      <meta charset="UTF-8">                                               + 7      <meta name="viewport" content="width=device-width, initial-scale=1.0 + 8  <!-- Title --> + 9      <title>HTML Test Page</title>                                        +10  <!-- Link to CSS --> +11      <link rel="stylesheet" href="styles.css">                            +12  </head>                                                                  +13   +14  <body>                                                                   +15  <!-- Header section --> +16      <header class="header">                                              +17          <h1 id="logo">HTML Test Page</h1>                                +18      </header>                                                            +19   +20  <!-- Navigation --> +21      <nav class="nav">                                                    +22          <ul>                                                             +23              <li><a href="#">Home</a></li>                                +24              <li><a href="#">About</a></li>                               +25              <li><a href="#">Contact</a></li>                             +26          </ul>                                                            +27      </nav>                                                               +28   +29  <!-- Main content area --> +30      <main>                                                               +31          <article>                                                        +32              <h2>Welcome to the Test Page</h2>                            +33              <p>This is a paragraph to test the HTML structure.</p>       +34              <img src="test-image.jpg" alt="Test Image" width="300">      +35          </article>                                                       +36      </main>                                                              +37   +38  <!-- Form --> +39      <section>                                                            +40          <form action="/submit" method="post">                            +41              <label for="name">Name:</label>                              +42              <input type="text" id="name" name="name">                    +43              <input type="submit" value="Submit">                         +44          </form>                                                          +45      </section>                                                           +46   +47  <!-- Footer --> +48      <footer>                                                             +49          <p>&copy; 2023 HTML Test Page</p>                                +50      </footer>                                                            +51   +52  <!-- Script tag --> +53      <script src="scripts.js"></script>                                   +54  </body>                                                                  +55   +56  </html>                                                                  +57   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[java].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[java].svg index 0ef12ad64b..9c422ef3bc 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[java].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[java].svg @@ -19,475 +19,476 @@ font-weight: 700; } - .terminal-2130650080-matrix { + .terminal-3279170275-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2130650080-title { + .terminal-3279170275-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2130650080-r1 { fill: #121212 } -.terminal-2130650080-r2 { fill: #0178d4 } -.terminal-2130650080-r3 { fill: #c5c8c6 } -.terminal-2130650080-r4 { fill: #c2c2bf } -.terminal-2130650080-r5 { fill: #272822 } -.terminal-2130650080-r6 { fill: #f92672 } -.terminal-2130650080-r7 { fill: #f8f8f2 } -.terminal-2130650080-r8 { fill: #90908a } -.terminal-2130650080-r9 { fill: #75715e } -.terminal-2130650080-r10 { fill: #ae81ff } -.terminal-2130650080-r11 { fill: #e6db74 } -.terminal-2130650080-r12 { fill: #66d9ef;font-style: italic; } -.terminal-2130650080-r13 { fill: #003054 } + .terminal-3279170275-r1 { fill: #121212 } +.terminal-3279170275-r2 { fill: #0178d4 } +.terminal-3279170275-r3 { fill: #c5c8c6 } +.terminal-3279170275-r4 { fill: #c2c2bf } +.terminal-3279170275-r5 { fill: #272822 } +.terminal-3279170275-r6 { fill: #f92672 } +.terminal-3279170275-r7 { fill: #f8f8f2 } +.terminal-3279170275-r8 { fill: #a6e22e } +.terminal-3279170275-r9 { fill: #90908a } +.terminal-3279170275-r10 { fill: #75715e } +.terminal-3279170275-r11 { fill: #ae81ff } +.terminal-3279170275-r12 { fill: #e6db74 } +.terminal-3279170275-r13 { fill: #66d9ef;font-style: italic; } +.terminal-3279170275-r14 { fill: #003054 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  1  import java.util.ArrayList;                                             -  2  import java.util.HashMap;                                               -  3  import java.util.List;                                                  -  4  import java.util.Map;                                                   -  5   -  6  // Classes and interfaces -  7  interface Shape {                                                       -  8      double getArea();                                                   -  9  }                                                                       - 10   - 11  class Rectangle implements Shape {                                      - 12  private double width;                                               - 13  private double height;                                              - 14   - 15  public Rectangle(double width, double height) {                     - 16          this.width = width;                                             - 17          this.height = height;                                           - 18      }                                                                   - 19   - 20  @Override                                                           - 21  public double getArea() {                                           - 22  return width * height;                                          - 23      }                                                                   - 24  }                                                                       - 25   - 26  // Enums - 27  enum DaysOfWeek {                                                       - 28      MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY      - 29  }                                                                       - 30   - 31  publicclass Main {                                                     - 32  // Constants - 33  privatestaticfinal double PI = 3.14159;                           - 34   - 35  // Methods - 36  publicstatic int sum(int a, int b) {                               - 37  return a + b;                                                   - 38      }                                                                   - 39   - 40  publicstatic void main(String[] args) {                            - 41  // Variables - 42          String name = "John";                                           - 43          int age = 30;                                                   - 44          boolean isStudent = true;                                       - 45   - 46  // Printing variables - 47          System.out.println("Hello, " + name + "! You are " + age + " ye - 48   - 49  // Conditional statements - 50  if (age >= 18 && isStudent) {                                   - 51              System.out.println("You are an adult student.");            - 52          } elseif (age >= 18) {                                         - 53              System.out.println("You are an adult.");                    - 54          } else {                                                        - 55              System.out.println("You are a minor.");                     - 56          }                                                               - 57   - 58  // Arrays - 59          int[] numbers = {12345};                                - 60          System.out.println("Numbers: " + Arrays.toString(numbers));     - 61   - 62  // Lists - 63          List<String> fruits = new ArrayList<>();                        - 64          fruits.add("apple");                                            - 65          fruits.add("banana");                                           - 66          fruits.add("orange");                                           - 67          System.out.println("Fruits: " + fruits);                        - 68   - 69  // Loops - 70  for (int num : numbers) {                                       - 71              System.out.println("Number: " + num);                       - 72          }                                                               - 73   - 74  // Hash maps - 75          Map<String, Integer> scores = new HashMap<>();                  - 76          scores.put("Alice"100);                                       - 77          scores.put("Bob"80);                                          - 78          System.out.println("Alice's score: " + scores.get("Alice"));    - 79   - 80  // Exception handling - 81  try {                                                           - 82              int result = 10 / 0;                                        - 83          } catch (ArithmeticException e) {                               - 84              System.out.println("Error: " + e.getMessage());             - 85          }                                                               - 86   - 87  // Instantiating objects - 88          Rectangle rect = new Rectangle(1020);                         - 89          System.out.println("Rectangle area: " + rect.getArea());        - 90   - 91  // Enums - 92          DaysOfWeek today = DaysOfWeek.MONDAY;                           - 93          System.out.println("Today is " + today);                        - 94   - 95  // Calling methods - 96          int sum = sum(510);                                           - 97          System.out.println("Sum: " + sum);                              - 98   - 99  // Ternary operator -100          String message = age >= 18 ? "You are an adult." : "You are a m -101          System.out.println(message);                                    -102      }                                                                   -103  }                                                                       -104   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  1  importjava.util.ArrayList;                                             +  2  importjava.util.HashMap;                                               +  3  importjava.util.List;                                                  +  4  importjava.util.Map;                                                   +  5   +  6  // Classes and interfaces +  7  interfaceShape {                                                       +  8  double getArea();                                                   +  9  }                                                                       + 10   + 11  classRectangleimplementsShape {                                      + 12  privatedouble width;                                               + 13  privatedouble height;                                              + 14   + 15  publicRectangle(double width, double height) {                     + 16          this.width = width;                                             + 17          this.height = height;                                           + 18      }                                                                   + 19   + 20      @Override                                                           + 21  publicdouble getArea() {                                           + 22  return width * height;                                          + 23      }                                                                   + 24  }                                                                       + 25   + 26  // Enums + 27  enumDaysOfWeek {                                                       + 28      MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY      + 29  }                                                                       + 30   + 31  publicclassMain {                                                     + 32  // Constants + 33  privatestaticfinaldouble PI = 3.14159;                           + 34   + 35  // Methods + 36  publicstaticint sum(int a, int b) {                               + 37  return a + b;                                                   + 38      }                                                                   + 39   + 40  publicstaticvoid main(String[] args) {                            + 41  // Variables + 42  String name = "John";                                           + 43  int age = 30;                                                   + 44  boolean isStudent = true;                                       + 45   + 46  // Printing variables + 47  System.out.println("Hello, " + name + "! You are " + age + " ye + 48   + 49  // Conditional statements + 50  if (age >= 18 && isStudent) {                                   + 51  System.out.println("You are an adult student.");            + 52          } elseif (age >= 18) {                                         + 53  System.out.println("You are an adult.");                    + 54          } else {                                                        + 55  System.out.println("You are a minor.");                     + 56          }                                                               + 57   + 58  // Arrays + 59  int[] numbers = {12345};                                + 60  System.out.println("Numbers: " + Arrays.toString(numbers));     + 61   + 62  // Lists + 63  List<String> fruits = newArrayList<>();                        + 64  fruits.add("apple");                                            + 65  fruits.add("banana");                                           + 66  fruits.add("orange");                                           + 67  System.out.println("Fruits: " + fruits);                        + 68   + 69  // Loops + 70  for (int num : numbers) {                                       + 71  System.out.println("Number: " + num);                       + 72          }                                                               + 73   + 74  // Hash maps + 75  Map<StringInteger> scores = newHashMap<>();                  + 76  scores.put("Alice"100);                                       + 77  scores.put("Bob"80);                                          + 78  System.out.println("Alice's score: " + scores.get("Alice"));    + 79   + 80  // Exception handling + 81  try {                                                           + 82  int result = 10 / 0;                                        + 83          } catch (ArithmeticException e) {                               + 84  System.out.println("Error: " + e.getMessage());             + 85          }                                                               + 86   + 87  // Instantiating objects + 88  Rectangle rect = newRectangle(1020);                         + 89  System.out.println("Rectangle area: " + rect.getArea());        + 90   + 91  // Enums + 92  DaysOfWeek today = DaysOfWeek.MONDAY;                           + 93  System.out.println("Today is " + today);                        + 94   + 95  // Calling methods + 96  int sum = sum(510);                                           + 97  System.out.println("Sum: " + sum);                              + 98   + 99  // Ternary operator +100  String message = age >= 18 ? "You are an adult." : "You are a m +101  System.out.println(message);                                    +102      }                                                                   +103  }                                                                       +104   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[javascript].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[javascript].svg index ed826436ef..645ea326fa 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[javascript].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[javascript].svg @@ -19,371 +19,371 @@ font-weight: 700; } - .terminal-3538840080-matrix { + .terminal-2506662657-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-3538840080-title { + .terminal-2506662657-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-3538840080-r1 { fill: #121212 } -.terminal-3538840080-r2 { fill: #0178d4 } -.terminal-3538840080-r3 { fill: #c5c8c6 } -.terminal-3538840080-r4 { fill: #c2c2bf } -.terminal-3538840080-r5 { fill: #272822 } -.terminal-3538840080-r6 { fill: #75715e } -.terminal-3538840080-r7 { fill: #f8f8f2 } -.terminal-3538840080-r8 { fill: #90908a } -.terminal-3538840080-r9 { fill: #f92672 } -.terminal-3538840080-r10 { fill: #e6db74 } -.terminal-3538840080-r11 { fill: #ae81ff } -.terminal-3538840080-r12 { fill: #66d9ef;font-style: italic; } -.terminal-3538840080-r13 { fill: #a6e22e } + .terminal-2506662657-r1 { fill: #121212 } +.terminal-2506662657-r2 { fill: #0178d4 } +.terminal-2506662657-r3 { fill: #c5c8c6 } +.terminal-2506662657-r4 { fill: #c2c2bf } +.terminal-2506662657-r5 { fill: #272822 } +.terminal-2506662657-r6 { fill: #75715e } +.terminal-2506662657-r7 { fill: #f8f8f2 } +.terminal-2506662657-r8 { fill: #90908a } +.terminal-2506662657-r9 { fill: #f92672 } +.terminal-2506662657-r10 { fill: #e6db74 } +.terminal-2506662657-r11 { fill: #ae81ff } +.terminal-2506662657-r12 { fill: #66d9ef;font-style: italic; } +.terminal-2506662657-r13 { fill: #a6e22e } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - 1  // Variable declarations - 2  const name ="John";                                                     - 3  let age =30;                                                            - 4  var isStudent =true;                                                    - 5   - 6  // Template literals - 7  console.log(`Hello, ${name}! You are ${age} years old.`);                - 8   - 9  // Conditional statements -10  if (age >=18&& isStudent) {                                            -11    console.log("You are an adult student.");                              -12  elseif (age >=18) {                                                  -13    console.log("You are an adult.");                                      -14  else {                                                                 -15    console.log("You are a minor.");                                       -16  }                                                                        -17   -18  // Arrays and array methods -19  const numbers = [12345];                                         -20  const doubledNumbers = numbers.map((num) => num *2);                    -21  console.log("Doubled numbers:", doubledNumbers);                         -22   -23  // Objects -24  const person = {                                                         -25    firstName: "John",                                                     -26    lastName: "Doe",                                                       -27    getFullName() {                                                        -28  return`${this.firstName} ${this.lastName}`;                         -29    },                                                                     -30  };                                                                       -31  console.log("Full name:", person.getFullName());                         -32   -33  // Classes -34  class Rectangle {                                                        -35    constructor(width, height) {                                           -36      this.width = width;                                                  -37      this.height = height;                                                -38    }                                                                      -39   -40    getArea() {                                                            -41  return this.width * this.height;                                     -42    }                                                                      -43  }                                                                        -44  const rectangle =new Rectangle(53);                                   -45  console.log("Rectangle area:", rectangle.getArea());                     -46   -47  // Async/Await and Promises -48  asyncfunctionfetchData() {                                             -49  try {                                                                  -50  const response =awaitfetch("https://api.example.com/data");        -51  const data =await response.json();                                  -52      console.log("Fetched data:", data);                                  -53    } catch (error) {                                                      -54      console.error("Error:", error);                                      -55    }                                                                      -56  }                                                                        -57  fetchData();                                                             -58   -59  // Arrow functions -60  constgreet= (name) => {                                                -61    console.log(`Hello, ${name}!`);                                        -62  };                                                                       -63  greet("Alice");                                                          -64   -65  // Destructuring assignment -66  const [a, b, ...rest] = [12345];                                 -67  console.log(a, b, rest);                                                 -68   -69  // Spread operator -70  const arr1 = [123];                                                  -71  const arr2 = [456];                                                  -72  const combinedArr = [...arr1, ...arr2];                                  -73  console.log("Combined array:", combinedArr);                             -74   -75  // Ternary operator -76  const message = age >=18 ? "You are an adult." : "You are a minor.";    -77  console.log(message);                                                    -78   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + 1  // Variable declarations + 2  const name = "John";                                                     + 3  let age = 30;                                                            + 4  var isStudent = true;                                                    + 5   + 6  // Template literals + 7  console.log(`Hello, ${name}! You are ${age} years old.`);                + 8   + 9  // Conditional statements +10  if (age >= 18 && isStudent) {                                            +11    console.log("You are an adult student.");                              +12  elseif (age >= 18) {                                                  +13    console.log("You are an adult.");                                      +14  else {                                                                 +15    console.log("You are a minor.");                                       +16  }                                                                        +17   +18  // Arrays and array methods +19  const numbers = [12345];                                         +20  const doubledNumbers = numbers.map((num) => num * 2);                    +21  console.log("Doubled numbers:", doubledNumbers);                         +22   +23  // Objects +24  const person = {                                                         +25    firstName: "John",                                                     +26    lastName: "Doe",                                                       +27    getFullName() {                                                        +28  return`${this.firstName}${this.lastName}`;                         +29    },                                                                     +30  };                                                                       +31  console.log("Full name:", person.getFullName());                         +32   +33  // Classes +34  class Rectangle {                                                        +35    constructor(width, height) {                                           +36      this.width = width;                                                  +37      this.height = height;                                                +38    }                                                                      +39   +40    getArea() {                                                            +41  return this.width * this.height;                                     +42    }                                                                      +43  }                                                                        +44  const rectangle = new Rectangle(53);                                   +45  console.log("Rectangle area:", rectangle.getArea());                     +46   +47  // Async/Await and Promises +48  asyncfunctionfetchData() {                                             +49  try {                                                                  +50  const response = awaitfetch("https://api.example.com/data");        +51  const data = await response.json();                                  +52      console.log("Fetched data:", data);                                  +53    } catch (error) {                                                      +54      console.error("Error:", error);                                      +55    }                                                                      +56  }                                                                        +57  fetchData();                                                             +58   +59  // Arrow functions +60  constgreet = (name) => {                                                +61    console.log(`Hello, ${name}!`);                                        +62  };                                                                       +63  greet("Alice");                                                          +64   +65  // Destructuring assignment +66  const [a, b, ...rest] = [12345];                                 +67  console.log(a, b, rest);                                                 +68   +69  // Spread operator +70  const arr1 = [123];                                                  +71  const arr2 = [456];                                                  +72  const combinedArr = [...arr1, ...arr2];                                  +73  console.log("Combined array:", combinedArr);                             +74   +75  // Ternary operator +76  const message = age >= 18 ? "You are an adult." : "You are a minor.";    +77  console.log(message);                                                    +78   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[kotlin].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[kotlin].svg deleted file mode 100644 index 1ec8590e47..0000000000 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[kotlin].svg +++ /dev/null @@ -1,461 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TextAreaSnapshot - - - - - - - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - 1  // Variables - 2  val name ="John" - 3  var age =30 - 4  var isStudent =true - 5   - 6  // Printing variables - 7  println("Hello, $name! You are $age years old.")                         - 8   - 9  // Conditional statements -10  when {                                                                   -11      age >=18&& isStudent ->println("You are an adult student.")       -12      age >=18->println("You are an adult.")                            -13  else->println("You are a minor.")                                  -14  }                                                                        -15   -16  // Arrays -17  val numbers =arrayOf(12345)                                     -18  println("Numbers: ${numbers.contentToString()}")                         -19   -20  // Lists -21  val fruits =listOf("apple""banana""orange")                         -22  println("Fruits: $fruits")                                               -23   -24  // Loops -25  for (num in numbers) {                                                   -26  println("Number: $num")                                              -27  }                                                                        -28   -29  // Functions -30  fungreet(name: String) {                                                -31  println("Hello, $name!")                                             -32  }                                                                        -33  greet("Alice")                                                           -34   -35  // Lambda functions -36  val square = { num: Int -> num * num }                                   -37  println("Square of 5: ${square(5)}")                                     -38   -39  // Extension functions -40  fun String.reverse(): String {                                           -41  return this.reversed() -42  }                                                                        -43  val reversed ="Hello".reverse()                                         -44  println("Reversed: $reversed")                                           -45   -46  // Data classes -47  dataclass Person(val name: String, val age: Int)                        -48  val person =Person("John"30)                                          -49  println("Person: $person")                                               -50   -51  // Null safety -52  var nullable: String? =null -53  println("Length: ${nullable?.length}")                                   -54   -55  // Elvis operator -56  val length = nullable?.length ?:0 -57  println("Length (Elvis): $length")                                       -58   -59  // Smart casts -60  funprintLength(obj: Any) {                                              -61  if (obj is String) {                                                 -62  println("Length: ${obj.length}")                                 -63      }                                                                    -64  }                                                                        -65  printLength("Hello")                                                     -66   -67  // Object expressions -68  val comparator =object : Comparator<Int> {                              -69  overridefun compare(a: Int, b: Int): Int {                          -70  return a - b -71      }                                                                    -72  }                                                                        -73  val sortedNumbers = numbers.sortedWith(comparator)                       -74  println("Sorted numbers: ${sortedNumbers.contentToString()}")            -75   -76  // Companion objects -77  class MyClass {                                                          -78      companion object {                                                   -79  funcreate(): MyClass {                                          -80  return MyClass() -81          }                                                                -82      }                                                                    -83  }                                                                        -84  val obj = MyClass.create()                                               -85   -86  // Sealed classes -87  sealedclass Result {                                                    -88  dataclass Success(val data: String) : Result()                      -89  dataclass Error(val message: String) : Result()                     -90  }                                                                        -91  val result: Result = Result.Success("Data")                              -92  when (result) {                                                          -93  is Result.Success ->println("Success: ${result.data}")              -94  is Result.Error ->println("Error: ${result.message}")               -95  }                                                                        -96   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - - - diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[markdown].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[markdown].svg index 381218534d..6ba550716a 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[markdown].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[markdown].svg @@ -19,333 +19,329 @@ font-weight: 700; } - .terminal-522116356-matrix { + .terminal-2324087897-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-522116356-title { + .terminal-2324087897-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-522116356-r1 { fill: #121212 } -.terminal-522116356-r2 { fill: #0178d4 } -.terminal-522116356-r3 { fill: #c5c8c6 } -.terminal-522116356-r4 { fill: #c2c2bf } -.terminal-522116356-r5 { fill: #272822;font-weight: bold } -.terminal-522116356-r6 { fill: #f92672;font-weight: bold } -.terminal-522116356-r7 { fill: #f8f8f2 } -.terminal-522116356-r8 { fill: #90908a } -.terminal-522116356-r9 { fill: #f8f8f2;font-style: italic; } -.terminal-522116356-r10 { fill: #f8f8f2;font-weight: bold } -.terminal-522116356-r11 { fill: #e6db74 } -.terminal-522116356-r12 { fill: #75715e } -.terminal-522116356-r13 { fill: #66d9ef;text-decoration: underline; } -.terminal-522116356-r14 { fill: #272822 } -.terminal-522116356-r15 { fill: #003054 } + .terminal-2324087897-r1 { fill: #121212 } +.terminal-2324087897-r2 { fill: #0178d4 } +.terminal-2324087897-r3 { fill: #c5c8c6 } +.terminal-2324087897-r4 { fill: #c2c2bf } +.terminal-2324087897-r5 { fill: #272822;font-weight: bold } +.terminal-2324087897-r6 { fill: #f92672;font-weight: bold } +.terminal-2324087897-r7 { fill: #f8f8f2 } +.terminal-2324087897-r8 { fill: #90908a } +.terminal-2324087897-r9 { fill: #90908a;font-weight: bold } +.terminal-2324087897-r10 { fill: #272822 } +.terminal-2324087897-r11 { fill: #003054 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - 1  Heading - 2  =======                                                                  - 3   - 4  Sub-heading - 5  -----------                                                              - 6   - 7  ### Heading - 8   - 9  #### H4 Heading -10   -11  ##### H5 Heading -12   -13  ###### H6 Heading -14   -15   -16  Paragraphs are separated                                                 -17  by a blank line.                                                         -18   -19  Two spaces at the end of a line                                          -20  produces a line break.                                                   -21   -22  Text attributes _italic_,                                                -23  **bold**`monospace`.                                                   -24   -25  Horizontal rule:                                                         -26   -27  ---                                                                      -28   -29  Bullet list:                                                             -30   -31  * apples                                                               -32  * oranges                                                              -33  * pears                                                                -34   -35  Numbered list:                                                           -36   -37  1. lather                                                              -38  2. rinse                                                               -39  3. repeat                                                              -40   -41  An [example](http://example.com).                                        -42   -43  > Markdown uses email-style > characters for blockquoting.               -44  >                                                                        -45  > Lorem ipsum                                                            -46   -47  ![progress](https://github.com/textualize/rich/raw/master/imgs/progress. -48   -49   -50  ```                                                                      -51  a=1                                                                      -52  ```                                                                      -53   -54  ```python                                                                -55  import this                                                              -56  ```                                                                      -57   -58  ```somelang                                                              -59  foobar                                                                   -60  ```                                                                      -61   -62      import this                                                          -63   -64   -65  1. List item                                                             -66   -67         Code block                                                        -68   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + 1  Heading  + 2  ======= + 3   + 4  Sub-heading  + 5  ----------- + 6   + 7  ###Heading + 8   + 9  ####H4 Heading +10   +11  #####H5 Heading +12   +13  ######H6 Heading +14   +15   +16  Paragraphs are separated                                                 +17  by a blank line.                                                         +18   +19  Two spaces at the end of a line                                          +20  produces a line break.                                                   +21   +22  Text attributes _italic_,                                                +23  **bold**, `monospace`.                                                   +24   +25  Horizontal rule:                                                         +26   +27  ---  +28    +29  Bullet list:                                                             +30   +31    * apples                                                               +32  oranges                                                              +33  pears                                                                +34   +35  Numbered list:                                                           +36   +37    1. lather                                                              +38  2. rinse                                                               +39  3. repeat                                                              +40   +41  An [example](http://example.com).                                        +42   +43  > Markdown uses email-style > characters for blockquoting.               +44  >                                                                        +45  > Lorem ipsum                                                            +46   +47  ![progress](https://github.com/textualize/rich/raw/master/imgs/progress. +48   +49   +50  ```                                                                      +51  a=1                                                                      +52  ```                                                                      +53   +54  ```python                                                                +55  import this                                                              +56  ```                                                                      +57   +58  ```somelang                                                              +59  foobar                                                                   +60  ```                                                                      +61   +62      import this                                                          +63   +64   +65  1. List item                                                             +66   +67         Code block                                                        +68   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[python].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[python].svg index 71f2c0804b..4d171f3936 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[python].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[python].svg @@ -19,375 +19,375 @@ font-weight: 700; } - .terminal-3825640886-matrix { + .terminal-3306911734-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-3825640886-title { + .terminal-3306911734-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-3825640886-r1 { fill: #121212 } -.terminal-3825640886-r2 { fill: #0178d4 } -.terminal-3825640886-r3 { fill: #c5c8c6 } -.terminal-3825640886-r4 { fill: #c2c2bf } -.terminal-3825640886-r5 { fill: #272822 } -.terminal-3825640886-r6 { fill: #f92672 } -.terminal-3825640886-r7 { fill: #f8f8f2 } -.terminal-3825640886-r8 { fill: #90908a } -.terminal-3825640886-r9 { fill: #75715e } -.terminal-3825640886-r10 { fill: #e6db74 } -.terminal-3825640886-r11 { fill: #ae81ff } -.terminal-3825640886-r12 { fill: #a6e22e } -.terminal-3825640886-r13 { fill: #003054 } + .terminal-3306911734-r1 { fill: #121212 } +.terminal-3306911734-r2 { fill: #0178d4 } +.terminal-3306911734-r3 { fill: #c5c8c6 } +.terminal-3306911734-r4 { fill: #c2c2bf } +.terminal-3306911734-r5 { fill: #272822 } +.terminal-3306911734-r6 { fill: #f92672 } +.terminal-3306911734-r7 { fill: #f8f8f2 } +.terminal-3306911734-r8 { fill: #90908a } +.terminal-3306911734-r9 { fill: #75715e } +.terminal-3306911734-r10 { fill: #e6db74 } +.terminal-3306911734-r11 { fill: #ae81ff } +.terminal-3306911734-r12 { fill: #a6e22e } +.terminal-3306911734-r13 { fill: #003054 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - 1  import math                                                              - 2  from os import path                                                      - 3   - 4  # I'm a comment :) - 5   - 6  string_var ="Hello, world!" - 7  int_var =42 - 8  float_var =3.14 - 9  complex_var =1+2j -10   -11  list_var = [12345]                                               -12  tuple_var = (12345)                                              -13  set_var = {12345}                                                -14  dict_var = {"a"1"b"2"c"3}                                      -15   -16  deffunction_no_args():                                                  -17  return"No arguments" -18   -19  deffunction_with_args(a, b):                                            -20  return a + b                                                         -21   -22  deffunction_with_default_args(a=0, b=0):                                -23  return a * b                                                         -24   -25  lambda_func =lambda x: x**2 -26   -27  if int_var ==42:                                                        -28  print("It's the answer!")                                            -29  elif int_var <42:                                                       -30  print("Less than the answer.")                                       -31  else:                                                                    -32  print("Greater than the answer.")                                    -33   -34  for index, value inenumerate(list_var):                                 -35  print(f"Index: {index}, Value: {value}")                             -36   -37  counter =0 -38  while counter <5:                                                       -39  print(f"Counter value: {counter}")                                   -40      counter +=1 -41   -42  squared_numbers = [x**2for x inrange(10if x %2==0]                -43   -44  try:                                                                     -45      result =10/0 -46  except ZeroDivisionError:                                                -47  print("Cannot divide by zero!")                                      -48  finally:                                                                 -49  print("End of try-except block.")                                    -50   -51  classAnimal:                                                            -52  def__init__(self, name):                                            -53          self.name = name                                                 -54   -55  defspeak(self):                                                     -56  raiseNotImplementedError("Subclasses must implement this method -57   -58  classDog(Animal):                                                       -59  defspeak(self):                                                     -60  returnf"{self.name} says Woof!" -61   -62  deffibonacci(n):                                                        -63      a, b =01 -64  for _ inrange(n):                                                   -65  yield a                                                          -66          a, b = b, a + b                                                  -67   -68  for num infibonacci(5):                                                 -69  print(num)                                                           -70   -71  withopen('test.txt''w'as f:                                         -72      f.write("Testing with statement.")                                   -73   -74  @my_decorator                                                            -75  defsay_hello():                                                         -76  print("Hello!")                                                      -77   -78  say_hello()                                                              -79   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + 1  import math                                                              + 2  from os import path                                                      + 3   + 4  # I'm a comment :) + 5   + 6  string_var = "Hello, world!" + 7  int_var = 42 + 8  float_var = 3.14 + 9  complex_var = 1 + 2j +10   +11  list_var = [12345]                                               +12  tuple_var = (12345)                                              +13  set_var = {12345}                                                +14  dict_var = {"a"1"b"2"c"3}                                      +15   +16  deffunction_no_args():                                                  +17  return"No arguments" +18   +19  deffunction_with_args(a, b):                                            +20  return a + b                                                         +21   +22  deffunction_with_default_args(a=0, b=0):                                +23  return a * b                                                         +24   +25  lambda_func = lambda x: x**2 +26   +27  if int_var == 42:                                                        +28  print("It's the answer!")                                            +29  elif int_var < 42:                                                       +30  print("Less than the answer.")                                       +31  else:                                                                    +32  print("Greater than the answer.")                                    +33   +34  for index, value inenumerate(list_var):                                 +35  print(f"Index: {index}, Value: {value}")                             +36   +37  counter = 0 +38  while counter < 5:                                                       +39  print(f"Counter value: {counter}")                                   +40      counter += 1 +41   +42  squared_numbers = [x**2for x inrange(10if x % 2 == 0]                +43   +44  try:                                                                     +45      result = 10 / 0 +46  except ZeroDivisionError:                                                +47  print("Cannot divide by zero!")                                      +48  finally:                                                                 +49  print("End of try-except block.")                                    +50   +51  classAnimal:                                                            +52  def__init__(self, name):                                            +53          self.name = name                                                 +54   +55  defspeak(self):                                                     +56  raiseNotImplementedError("Subclasses must implement this method +57   +58  classDog(Animal):                                                       +59  defspeak(self):                                                     +60  returnf"{self.name} says Woof!" +61   +62  deffibonacci(n):                                                        +63      a, b = 01 +64  for _ inrange(n):                                                   +65  yield a                                                          +66          a, b = b, a + b                                                  +67   +68  for num infibonacci(5):                                                 +69  print(num)                                                           +70   +71  withopen('test.txt''w'as f:                                         +72      f.write("Testing with statement.")                                   +73   +74  @my_decorator                                                            +75  defsay_hello():                                                         +76  print("Hello!")                                                      +77   +78  say_hello()                                                              +79   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[regex].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[regex].svg index 148c9fbd18..17d7bfffea 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[regex].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[regex].svg @@ -19,157 +19,156 @@ font-weight: 700; } - .terminal-2880426604-matrix { + .terminal-2440213227-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2880426604-title { + .terminal-2440213227-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2880426604-r1 { fill: #121212 } -.terminal-2880426604-r2 { fill: #0178d4 } -.terminal-2880426604-r3 { fill: #c5c8c6 } -.terminal-2880426604-r4 { fill: #c2c2bf } -.terminal-2880426604-r5 { fill: #272822 } -.terminal-2880426604-r6 { fill: #e6db74 } -.terminal-2880426604-r7 { fill: #f8f8f2 } -.terminal-2880426604-r8 { fill: #90908a } -.terminal-2880426604-r9 { fill: #f92672 } -.terminal-2880426604-r10 { fill: #ae81ff } -.terminal-2880426604-r11 { fill: #003054 } + .terminal-2440213227-r1 { fill: #121212 } +.terminal-2440213227-r2 { fill: #0178d4 } +.terminal-2440213227-r3 { fill: #c5c8c6 } +.terminal-2440213227-r4 { fill: #c2c2bf } +.terminal-2440213227-r5 { fill: #272822 } +.terminal-2440213227-r6 { fill: #e6db74 } +.terminal-2440213227-r7 { fill: #f8f8f2 } +.terminal-2440213227-r8 { fill: #90908a } +.terminal-2440213227-r9 { fill: #ae81ff } +.terminal-2440213227-r10 { fill: #003054 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - 1  ^abc            # Matches any string that starts with "abc" - 2  abc$            # Matches any string that ends with "abc" - 3  ^abc$           # Matches the string "abc" and nothing else - 4  a.b             # Matches any string containing "a", any character, then - 5  a[.]b           # Matches the string "a.b" - 6  a|b             # Matches either "a" or "b" - 7  a{2}            # Matches "aa" - 8  a{2,}           # Matches two or more consecutive "a" characters - 9  a{2,5}          # Matches between 2 and 5 consecutive "a" characters -10  a?              # Matches "a" or nothing (0 or 1 occurrence of "a")      -11  a*              # Matches zero or more consecutive "a" characters -12  a+              # Matches one or more consecutive "a" characters -13  \d              # Matches any digit (equivalent to [0-9])                -14  \D              # Matches any non-digit -15  \w              # Matches any word character (equivalent to [a-zA-Z0-9_] -16  \W              # Matches any non-word character -17  \s              # Matches any whitespace character (spaces, tabs, line b -18  \S              # Matches any non-whitespace character -19  (?i)abc         # Case-insensitive match for "abc" -20  (?:a|b)         # Non-capturing group for either "a" or "b" -21  (?<=a)b         # Positive lookbehind: matches "b" that is preceded by " -22  (?<!a)b         # Negative lookbehind: matches "b" that is not preceded  -23  a(?=b)          # Positive lookahead: matches "a" that is followed by "b -24  a(?!b)          # Negative lookahead: matches "a" that is not followed b -25   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + 1  ^abc            # Matches any string that starts with "abc" + 2  abc$            # Matches any string that ends with "abc" + 3  ^abc$           # Matches the string "abc" and nothing else + 4  a.b             # Matches any string containing "a", any character, then + 5  a[.]b           # Matches the string "a.b" + 6  a|b             # Matches either "a" or "b" + 7  a{2}            # Matches "aa" + 8  a{2,}           # Matches two or more consecutive "a" characters + 9  a{2,5}          # Matches between 2 and 5 consecutive "a" characters +10  a?              # Matches "a" or nothing (0 or 1 occurrence of "a")      +11  a*              # Matches zero or more consecutive "a" characters +12  a+              # Matches one or more consecutive "a" characters +13  \d              # Matches any digit (equivalent to [0-9])                +14  \D              # Matches any non-digit +15  \w              # Matches any word character (equivalent to [a-zA-Z0-9_] +16  \W              # Matches any non-word character +17  \s              # Matches any whitespace character (spaces, tabs, line b +18  \S              # Matches any non-whitespace character +19  (?i)abc         # Case-insensitive match for "abc" +20  (?:a|b)         # Non-capturing group for either "a" or "b" +21  (?<=a)b         # Positive lookbehind: matches "b" that is preceded by " +22  (?<!a)b         # Negative lookbehind: matches "b" that is not preceded  +23  a(?=b)          # Positive lookahead: matches "a" that is followed by "b +24  a(?!b)          # Negative lookahead: matches "a" that is not followed b +25   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[rust].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[rust].svg index a6a622ead0..aba319a6cb 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[rust].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[rust].svg @@ -19,479 +19,479 @@ font-weight: 700; } - .terminal-3534299323-matrix { + .terminal-2677345600-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-3534299323-title { + .terminal-2677345600-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-3534299323-r1 { fill: #121212 } -.terminal-3534299323-r2 { fill: #0178d4 } -.terminal-3534299323-r3 { fill: #c5c8c6 } -.terminal-3534299323-r4 { fill: #c2c2bf } -.terminal-3534299323-r5 { fill: #272822 } -.terminal-3534299323-r6 { fill: #f92672 } -.terminal-3534299323-r7 { fill: #f8f8f2 } -.terminal-3534299323-r8 { fill: #90908a } -.terminal-3534299323-r9 { fill: #75715e } -.terminal-3534299323-r10 { fill: #66d9ef;font-style: italic; } -.terminal-3534299323-r11 { fill: #a6e22e } -.terminal-3534299323-r12 { fill: #e6db74 } -.terminal-3534299323-r13 { fill: #003054 } + .terminal-2677345600-r1 { fill: #121212 } +.terminal-2677345600-r2 { fill: #0178d4 } +.terminal-2677345600-r3 { fill: #c5c8c6 } +.terminal-2677345600-r4 { fill: #c2c2bf } +.terminal-2677345600-r5 { fill: #272822 } +.terminal-2677345600-r6 { fill: #f92672 } +.terminal-2677345600-r7 { fill: #f8f8f2 } +.terminal-2677345600-r8 { fill: #a6e22e } +.terminal-2677345600-r9 { fill: #90908a } +.terminal-2677345600-r10 { fill: #75715e } +.terminal-2677345600-r11 { fill: #66d9ef;font-style: italic; } +.terminal-2677345600-r12 { fill: #e6db74 } +.terminal-2677345600-r13 { fill: #003054 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  1  use std::collections::HashMap;                                          -  2   -  3  // Constants -  4  const PI: f64 = 3.14159;                                                -  5   -  6  // Structs -  7  struct Rectangle {                                                      -  8      width: u32,                                                         -  9      height: u32,                                                        - 10  }                                                                       - 11   - 12  impl Rectangle {                                                        - 13  fnarea(&self) -> u32 {                                             - 14          self.width * self.height                                        - 15      }                                                                   - 16  }                                                                       - 17   - 18  // Enums - 19  enum Result<T, E> {                                                     - 20      Ok(T),                                                              - 21      Err(E),                                                             - 22  }                                                                       - 23   - 24  // Functions - 25  fngreet(name: &str) {                                                  - 26      println!("Hello, {}!", name);                                       - 27  }                                                                       - 28   - 29  fnmain() {                                                             - 30  // Variables - 31  let name = "John";                                                  - 32  letmut age = 30;                                                   - 33  let is_student = true;                                              - 34   - 35  // Printing variables - 36      println!("Hello, {}! You are {} years old.", name, age);            - 37   - 38  // Conditional statements - 39  if age >= 18 && is_student {                                        - 40          println!("You are an adult student.");                          - 41      } elseif age >= 18 {                                               - 42          println!("You are an adult.");                                  - 43      } else {                                                            - 44          println!("You are a minor.");                                   - 45      }                                                                   - 46   - 47  // Arrays - 48  let numbers = [12345];                                      - 49      println!("Numbers: {:?}", numbers);                                 - 50   - 51  // Vectors - 52  letmut fruits = vec!["apple""banana""orange"];                 - 53      fruits.push("grape");                                               - 54      println!("Fruits: {:?}", fruits);                                   - 55   - 56  // Loops - 57  for num in&numbers {                                               - 58          println!("Number: {}", num);                                    - 59      }                                                                   - 60   - 61  // Pattern matching - 62  let result = Result::Ok(42);                                        - 63  match result {                                                      - 64          Result::Ok(value) => println!("Value: {}", value),              - 65          Result::Err(error) => println!("Error: {:?}", error),           - 66      }                                                                   - 67   - 68  // Ownership and borrowing - 69  let s1 = String::from("hello");                                     - 70  let s2 = s1.clone();                                                - 71      println!("s1: {}, s2: {}", s1, s2);                                 - 72   - 73  // References - 74  let rect = Rectangle {                                              - 75          width: 10,                                                      - 76          height: 20,                                                     - 77      };                                                                  - 78      println!("Rectangle area: {}", rect.area());                        - 79   - 80  // Hash maps - 81  letmut scores = HashMap::new();                                    - 82      scores.insert("Alice"100);                                        - 83      scores.insert("Bob"80);                                           - 84      println!("Alice's score: {}", scores["Alice"]);                     - 85   - 86  // Closures - 87  let square = |num: i32| num * num;                                  - 88      println!("Square of 5: {}", square(5));                             - 89   - 90  // Traits - 91  trait Printable {                                                   - 92  fnprint(&self);                                                - 93      }                                                                   - 94   - 95  impl Printable for Rectangle {                                      - 96  fnprint(&self) {                                               - 97              println!("Rectangle: width={}, height={}", self.width, self - 98          }                                                               - 99      }                                                                   -100      rect.print();                                                       -101   -102  // Modules -103  greet("Alice");                                                     -104  }                                                                       -105   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  1  usestd::collections::HashMap;                                          +  2   +  3  // Constants +  4  const PI: f64 = 3.14159;                                                +  5   +  6  // Structs +  7  structRectangle {                                                      +  8      width: u32,                                                         +  9      height: u32,                                                        + 10  }                                                                       + 11   + 12  implRectangle {                                                        + 13  fnarea(&self) -> u32 {                                             + 14          self.width * self.height                                        + 15      }                                                                   + 16  }                                                                       + 17   + 18  // Enums + 19  enumResult<TE> {                                                     + 20      Ok(T),                                                              + 21      Err(E),                                                             + 22  }                                                                       + 23   + 24  // Functions + 25  fngreet(name: &str) {                                                  + 26      println!("Hello, {}!", name);                                       + 27  }                                                                       + 28   + 29  fnmain() {                                                             + 30  // Variables + 31  let name = "John";                                                  + 32  letmut age = 30;                                                   + 33  let is_student = true;                                              + 34   + 35  // Printing variables + 36      println!("Hello, {}! You are {} years old.", name, age);            + 37   + 38  // Conditional statements + 39  if age >= 18 && is_student {                                        + 40          println!("You are an adult student.");                          + 41      } elseif age >= 18 {                                               + 42          println!("You are an adult.");                                  + 43      } else {                                                            + 44          println!("You are a minor.");                                   + 45      }                                                                   + 46   + 47  // Arrays + 48  let numbers = [12345];                                      + 49      println!("Numbers: {:?}", numbers);                                 + 50   + 51  // Vectors + 52  letmut fruits = vec!["apple""banana""orange"];                 + 53      fruits.push("grape");                                               + 54      println!("Fruits: {:?}", fruits);                                   + 55   + 56  // Loops + 57  for num in &numbers {                                               + 58          println!("Number: {}", num);                                    + 59      }                                                                   + 60   + 61  // Pattern matching + 62  let result = Result::Ok(42);                                        + 63  match result {                                                      + 64  Result::Ok(value) => println!("Value: {}", value),              + 65  Result::Err(error) => println!("Error: {:?}", error),           + 66      }                                                                   + 67   + 68  // Ownership and borrowing + 69  let s1 = String::from("hello");                                     + 70  let s2 = s1.clone();                                                + 71      println!("s1: {}, s2: {}", s1, s2);                                 + 72   + 73  // References + 74  let rect = Rectangle {                                              + 75          width: 10,                                                      + 76          height: 20,                                                     + 77      };                                                                  + 78      println!("Rectangle area: {}", rect.area());                        + 79   + 80  // Hash maps + 81  letmut scores = HashMap::new();                                    + 82      scores.insert("Alice"100);                                        + 83      scores.insert("Bob"80);                                           + 84      println!("Alice's score: {}", scores["Alice"]);                     + 85   + 86  // Closures + 87  let square = |num: i32| num * num;                                  + 88      println!("Square of 5: {}", square(5));                             + 89   + 90  // Traits + 91  traitPrintable {                                                   + 92  fnprint(&self);                                                + 93      }                                                                   + 94   + 95  implPrintableforRectangle {                                      + 96  fnprint(&self) {                                               + 97              println!("Rectangle: width={}, height={}", self.width, self + 98          }                                                               + 99      }                                                                   +100      rect.print();                                                       +101   +102  // Modules +103  greet("Alice");                                                     +104  }                                                                       +105   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[sql].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[sql].svg index 8194e1abcf..924d26070c 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[sql].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[sql].svg @@ -19,235 +19,234 @@ font-weight: 700; } - .terminal-613695561-matrix { + .terminal-959683904-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-613695561-title { + .terminal-959683904-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-613695561-r1 { fill: #121212 } -.terminal-613695561-r2 { fill: #0178d4 } -.terminal-613695561-r3 { fill: #c5c8c6 } -.terminal-613695561-r4 { fill: #c2c2bf } -.terminal-613695561-r5 { fill: #272822 } -.terminal-613695561-r6 { fill: #75715e } -.terminal-613695561-r7 { fill: #f8f8f2 } -.terminal-613695561-r8 { fill: #90908a } -.terminal-613695561-r9 { fill: #f92672 } -.terminal-613695561-r10 { fill: #ae81ff } -.terminal-613695561-r11 { fill: #66d9ef;font-style: italic; } -.terminal-613695561-r12 { fill: #e6db74 } -.terminal-613695561-r13 { fill: #003054 } + .terminal-959683904-r1 { fill: #121212 } +.terminal-959683904-r2 { fill: #0178d4 } +.terminal-959683904-r3 { fill: #c5c8c6 } +.terminal-959683904-r4 { fill: #c2c2bf } +.terminal-959683904-r5 { fill: #272822 } +.terminal-959683904-r6 { fill: #75715e } +.terminal-959683904-r7 { fill: #f8f8f2 } +.terminal-959683904-r8 { fill: #90908a } +.terminal-959683904-r9 { fill: #f92672 } +.terminal-959683904-r10 { fill: #a6e22e } +.terminal-959683904-r11 { fill: #e6db74 } +.terminal-959683904-r12 { fill: #003054 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - 1  -- This is a comment in SQL - 2   - 3  -- Create tables - 4  CREATETABLE Authors (                                                   - 5      AuthorID INT PRIMARY KEY,                                            - 6      Name VARCHAR(255NOT NULL,                                          - 7      Country VARCHAR(50)                                                  - 8  );                                                                       - 9   -10  CREATETABLE Books (                                                     -11      BookID INT PRIMARY KEY,                                              -12      Title VARCHAR(255NOT NULL,                                         -13      AuthorID INT,                                                        -14      PublishedDate DATE,                                                  -15      FOREIGN KEY (AuthorID) REFERENCES Authors(AuthorID)                  -16  );                                                                       -17   -18  -- Insert data -19  INSERTINTO Authors (AuthorID, Name, Country) VALUES (1'George Orwell' -20   -21  INSERTINTO Books (BookID, Title, AuthorID, PublishedDate) VALUES (1'1 -22   -23  -- Update data -24  UPDATE Authors SET Country ='United Kingdom'WHERE Country ='UK';      -25   -26  -- Select data with JOIN -27  SELECT Books.Title, Authors.Name                                         -28  FROM Books                                                               -29  JOIN Authors ON Books.AuthorID = Authors.AuthorID;                       -30   -31  -- Delete data (commented to preserve data for other examples) -32  -- DELETE FROM Books WHERE BookID = 1; -33   -34  -- Alter table structure -35  ALTER TABLE Authors ADD COLUMN BirthDate DATE;                           -36   -37  -- Create index -38  CREATEINDEX idx_author_name ON Authors(Name);                           -39   -40  -- Drop index (commented to avoid actually dropping it) -41  -- DROP INDEX idx_author_name ON Authors; -42   -43  -- End of script -44   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + 1  -- This is a comment in SQL + 2   + 3  -- Create tables + 4  CREATETABLEAuthors (                                                   + 5      AuthorID INTPRIMARYKEY,                                            + 6      Name VARCHAR(255NOTNULL,                                          + 7      Country VARCHAR(50)                                                  + 8  );                                                                       + 9   +10  CREATETABLEBooks (                                                     +11      BookID INTPRIMARYKEY,                                              +12      Title VARCHAR(255NOTNULL,                                         +13      AuthorID INT,                                                        +14      PublishedDate DATE,                                                  +15  FOREIGNKEY (AuthorID) REFERENCESAuthors(AuthorID)                  +16  );                                                                       +17   +18  -- Insert data +19  INSERTINTOAuthors (AuthorID, Name, Country) VALUES (1'George Orwell' +20   +21  INSERTINTOBooks (BookID, Title, AuthorID, PublishedDate) VALUES (1'1 +22   +23  -- Update data +24  UPDATEAuthorsSET Country = 'United Kingdom'WHERE Country = 'UK';      +25   +26  -- Select data with JOIN +27  SELECTBooks.Title, Authors.Name                                         +28  FROMBooks +29  JOINAuthorsONBooks.AuthorID = Authors.AuthorID;                       +30   +31  -- Delete data (commented to preserve data for other examples) +32  -- DELETE FROM Books WHERE BookID = 1; +33   +34  -- Alter table structure +35  ALTERTABLEAuthorsADDCOLUMN BirthDate DATE;                           +36   +37  -- Create index +38  CREATEINDEX idx_author_name ONAuthors(Name);                           +39   +40  -- Drop index (commented to avoid actually dropping it) +41  -- DROP INDEX idx_author_name ON Authors; +42   +43  -- End of script +44   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[xml].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[xml].svg new file mode 100644 index 0000000000..9fbaac23dc --- /dev/null +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[xml].svg @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TextAreaSnapshot + + + + + + + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + 1  <?xml version="1.0" encoding="UTF-8"?>                                   + 2  <!-- This is an example XML document --> + 3  <library>                                                                + 4      <book id="1" genre="fiction">                                        + 5          <title>The Great Gatsby</title>                                  + 6          <author>F. Scott Fitzgerald</author>                             + 7          <published>1925</published>                                      + 8          <description><![CDATA[This classic novel explores themes of weal + 9      </book>                                                              +10      <book id="2" genre="non-fiction">                                    +11          <title>Sapiens: A Brief History of Humankind</title>             +12          <author>Yuval Noah Harari</author>                               +13          <published>2011</published>                                      +14          <description><![CDATA[Explores the history and impact of Homo sa +15      </book>                                                              +16  <!-- Another book can be added here --> +17  </library>                                                               +18   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[yaml].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[yaml].svg index 70022c2aca..f12b6d629f 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[yaml].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_language_rendering[yaml].svg @@ -19,210 +19,210 @@ font-weight: 700; } - .terminal-2127695819-matrix { + .terminal-2714046411-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2127695819-title { + .terminal-2714046411-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2127695819-r1 { fill: #121212 } -.terminal-2127695819-r2 { fill: #0178d4 } -.terminal-2127695819-r3 { fill: #c5c8c6 } -.terminal-2127695819-r4 { fill: #c2c2bf } -.terminal-2127695819-r5 { fill: #272822 } -.terminal-2127695819-r6 { fill: #75715e } -.terminal-2127695819-r7 { fill: #f8f8f2 } -.terminal-2127695819-r8 { fill: #90908a } -.terminal-2127695819-r9 { fill: #f92672;font-weight: bold } -.terminal-2127695819-r10 { fill: #e6db74 } -.terminal-2127695819-r11 { fill: #ae81ff } -.terminal-2127695819-r12 { fill: #66d9ef;font-style: italic; } + .terminal-2714046411-r1 { fill: #121212 } +.terminal-2714046411-r2 { fill: #0178d4 } +.terminal-2714046411-r3 { fill: #c5c8c6 } +.terminal-2714046411-r4 { fill: #c2c2bf } +.terminal-2714046411-r5 { fill: #272822 } +.terminal-2714046411-r6 { fill: #75715e } +.terminal-2714046411-r7 { fill: #f8f8f2 } +.terminal-2714046411-r8 { fill: #90908a } +.terminal-2714046411-r9 { fill: #f92672;font-weight: bold } +.terminal-2714046411-r10 { fill: #e6db74 } +.terminal-2714046411-r11 { fill: #ae81ff } +.terminal-2714046411-r12 { fill: #66d9ef;font-style: italic; } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - 1  # This is a comment in YAML - 2   - 3  # Scalars - 4  string"Hello, world!" - 5  integer42 - 6  float3.14 - 7  booleantrue - 8   - 9  # Sequences (Arrays) -10  fruits:                                                                  -11    - Apple -12    - Banana -13    - Cherry -14   -15  # Nested sequences -16  persons:                                                                 -17    - nameJohn -18  age28 -19  is_studentfalse -20    - nameJane -21  age22 -22  is_studenttrue -23   -24  # Mappings (Dictionaries) -25  address:                                                                 -26  street123 Main St -27  cityAnytown -28  stateCA -29  zip'12345' -30   -31  # Multiline string -32  description -33    This is a multiline  -34    string in YAML. -35   -36  # Inline and nested collections -37  colors: { redFF0000green00FF00blue0000FF }                     -38   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + 1  # This is a comment in YAML + 2   + 3  # Scalars + 4  string"Hello, world!" + 5  integer42 + 6  float3.14 + 7  booleantrue + 8   + 9  # Sequences (Arrays) +10  fruits:                                                                  +11    - Apple +12    - Banana +13    - Cherry +14   +15  # Nested sequences +16  persons:                                                                 +17    - nameJohn +18  age28 +19  is_studentfalse +20    - nameJane +21  age22 +22  is_studenttrue +23   +24  # Mappings (Dictionaries) +25  address:                                                                 +26  street123 Main St +27  cityAnytown +28  stateCA +29  zip'12345' +30   +31  # Multiline string +32  description: | +33    This is a multiline  +34    string in YAML. +35   +36  # Inline and nested collections +37  colors: { redFF0000green00FF00blue0000FF }                     +38   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[css].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[css].svg index 4fccefc760..0d6b98a198 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[css].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[css].svg @@ -19,81 +19,84 @@ font-weight: 700; } - .terminal-1008086625-matrix { + .terminal-1378439235-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-1008086625-title { + .terminal-1378439235-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-1008086625-r1 { fill: #121212 } -.terminal-1008086625-r2 { fill: #0178d4 } -.terminal-1008086625-r3 { fill: #c5c8c6 } -.terminal-1008086625-r4 { fill: #71716e } -.terminal-1008086625-r5 { fill: #569cd6 } -.terminal-1008086625-r6 { fill: #f8f8f2 } -.terminal-1008086625-r7 { fill: #4ec9b0 } -.terminal-1008086625-r8 { fill: #999997;font-weight: bold } -.terminal-1008086625-r9 { fill: #b5cea8 } -.terminal-1008086625-r10 { fill: #7daf9c } -.terminal-1008086625-r11 { fill: #ce9178 } + .terminal-1378439235-r1 { fill: #121212 } +.terminal-1378439235-r2 { fill: #0178d4 } +.terminal-1378439235-r3 { fill: #c5c8c6 } +.terminal-1378439235-r4 { fill: #71716e } +.terminal-1378439235-r5 { fill: #569cd6 } +.terminal-1378439235-r6 { fill: #f8f8f2 } +.terminal-1378439235-r7 { fill: #dcdcaa } +.terminal-1378439235-r8 { fill: #cccccc } +.terminal-1378439235-r9 { fill: #9cdcfe } +.terminal-1378439235-r10 { fill: #999997;font-weight: bold } +.terminal-1378439235-r11 { fill: #b5cea8 } +.terminal-1378439235-r12 { fill: #7daf9c } +.terminal-1378439235-r13 { fill: #4ec9b0 } +.terminal-1378439235-r14 { fill: #ce9178 } - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -1  defhello(name): -2      x =123 -3  whilenotFalse:                      -4  print("hello "+ name)            -5  continue -6   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +1  defhello(name): +2  x=123 +3  whilenotFalse: +4  print("hello "+name) +5  continue +6   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[dracula].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[dracula].svg index 1797b96ec2..2ec01a5ea3 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[dracula].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[dracula].svg @@ -19,81 +19,81 @@ font-weight: 700; } - .terminal-3949280110-matrix { + .terminal-789685810-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-3949280110-title { + .terminal-789685810-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-3949280110-r1 { fill: #121212 } -.terminal-3949280110-r2 { fill: #0178d4 } -.terminal-3949280110-r3 { fill: #c5c8c6 } -.terminal-3949280110-r4 { fill: #6272a4 } -.terminal-3949280110-r5 { fill: #ff79c6 } -.terminal-3949280110-r6 { fill: #f8f8f2 } -.terminal-3949280110-r7 { fill: #50fa7b } -.terminal-3949280110-r8 { fill: #c2c2bf;font-weight: bold } -.terminal-3949280110-r9 { fill: #bd93f9 } -.terminal-3949280110-r10 { fill: #282a36 } -.terminal-3949280110-r11 { fill: #f1fa8c } + .terminal-789685810-r1 { fill: #121212 } +.terminal-789685810-r2 { fill: #0178d4 } +.terminal-789685810-r3 { fill: #c5c8c6 } +.terminal-789685810-r4 { fill: #6272a4 } +.terminal-789685810-r5 { fill: #ff79c6 } +.terminal-789685810-r6 { fill: #f8f8f2 } +.terminal-789685810-r7 { fill: #c2c2bf;font-weight: bold } +.terminal-789685810-r8 { fill: #bd93f9 } +.terminal-789685810-r9 { fill: #282a36 } +.terminal-789685810-r10 { fill: #50fa7b } +.terminal-789685810-r11 { fill: #f1fa8c } - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -1  defhello(name): -2      x =123 -3  whilenotFalse:                      -4  print("hello "+ name)            -5  continue -6   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +1  def hello(name): +2      x = 123 +3  whilenotFalse:                      +4  print("hello " + name)            +5  continue +6   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[github_light].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[github_light].svg index 01acc76cd3..8def597c67 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[github_light].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[github_light].svg @@ -19,84 +19,83 @@ font-weight: 700; } - .terminal-68902300-matrix { + .terminal-3341902079-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-68902300-title { + .terminal-3341902079-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-68902300-r1 { fill: #121212 } -.terminal-68902300-r2 { fill: #0178d4 } -.terminal-68902300-r3 { fill: #c5c8c6 } -.terminal-68902300-r4 { fill: #bbbbbb } -.terminal-68902300-r5 { fill: #cf222e } -.terminal-68902300-r6 { fill: #24292e } -.terminal-68902300-r7 { fill: #6639bb } -.terminal-68902300-r8 { fill: #a4a4a4 } -.terminal-68902300-r9 { fill: #e36209 } -.terminal-68902300-r10 { fill: #0450ae } -.terminal-68902300-r11 { fill: #d73a49 } -.terminal-68902300-r12 { fill: #fafbfc } -.terminal-68902300-r13 { fill: #7daf9c } -.terminal-68902300-r14 { fill: #093069 } + .terminal-3341902079-r1 { fill: #121212 } +.terminal-3341902079-r2 { fill: #0178d4 } +.terminal-3341902079-r3 { fill: #c5c8c6 } +.terminal-3341902079-r4 { fill: #bbbbbb } +.terminal-3341902079-r5 { fill: #cf222e } +.terminal-3341902079-r6 { fill: #24292e } +.terminal-3341902079-r7 { fill: #6639bb } +.terminal-3341902079-r8 { fill: #a4a4a4 } +.terminal-3341902079-r9 { fill: #7daf9c } +.terminal-3341902079-r10 { fill: #0450ae } +.terminal-3341902079-r11 { fill: #d73a49 } +.terminal-3341902079-r12 { fill: #fafbfc } +.terminal-3341902079-r13 { fill: #093069 } - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - + - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -1  defhello(name): -2  x=123 -3  whilenotFalse:                      -4  print("hello "+name)            -5  continue -6   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +1  defhello(name): +2  x=123 +3  whilenotFalse:                      +4  print("hello "+name)            +5  continue +6   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[monokai].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[monokai].svg index 26f2b6aa4a..f69e242c44 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[monokai].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[monokai].svg @@ -19,82 +19,82 @@ font-weight: 700; } - .terminal-2288398405-matrix { + .terminal-2677119763-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2288398405-title { + .terminal-2677119763-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2288398405-r1 { fill: #121212 } -.terminal-2288398405-r2 { fill: #0178d4 } -.terminal-2288398405-r3 { fill: #c5c8c6 } -.terminal-2288398405-r4 { fill: #90908a } -.terminal-2288398405-r5 { fill: #f92672 } -.terminal-2288398405-r6 { fill: #f8f8f2 } -.terminal-2288398405-r7 { fill: #a6e22e } -.terminal-2288398405-r8 { fill: #c2c2bf } -.terminal-2288398405-r9 { fill: #ae81ff } -.terminal-2288398405-r10 { fill: #272822 } -.terminal-2288398405-r11 { fill: #66d9ef;font-style: italic; } -.terminal-2288398405-r12 { fill: #e6db74 } + .terminal-2677119763-r1 { fill: #121212 } +.terminal-2677119763-r2 { fill: #0178d4 } +.terminal-2677119763-r3 { fill: #c5c8c6 } +.terminal-2677119763-r4 { fill: #90908a } +.terminal-2677119763-r5 { fill: #f92672 } +.terminal-2677119763-r6 { fill: #f8f8f2 } +.terminal-2677119763-r7 { fill: #c2c2bf } +.terminal-2677119763-r8 { fill: #ae81ff } +.terminal-2677119763-r9 { fill: #272822 } +.terminal-2677119763-r10 { fill: #66d9ef;font-style: italic; } +.terminal-2677119763-r11 { fill: #a6e22e } +.terminal-2677119763-r12 { fill: #e6db74 } - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -1  defhello(name): -2      x =123 -3  whilenotFalse:                      -4  print("hello "+ name)            -5  continue -6   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +1  def hello(name): +2      x = 123 +3  whilenotFalse:                      +4  print("hello " + name)            +5  continue +6   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[vscode_dark].svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[vscode_dark].svg index a0b46b3957..1185984e0c 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[vscode_dark].svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_themes[vscode_dark].svg @@ -19,81 +19,83 @@ font-weight: 700; } - .terminal-2255832906-matrix { + .terminal-2571030914-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2255832906-title { + .terminal-2571030914-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2255832906-r1 { fill: #121212 } -.terminal-2255832906-r2 { fill: #0178d4 } -.terminal-2255832906-r3 { fill: #c5c8c6 } -.terminal-2255832906-r4 { fill: #6e7681 } -.terminal-2255832906-r5 { fill: #569cd6 } -.terminal-2255832906-r6 { fill: #cccccc } -.terminal-2255832906-r7 { fill: #4ec9b0 } -.terminal-2255832906-r8 { fill: #b5cea8 } -.terminal-2255832906-r9 { fill: #1e1e1e } -.terminal-2255832906-r10 { fill: #7daf9c } -.terminal-2255832906-r11 { fill: #ce9178 } + .terminal-2571030914-r1 { fill: #121212 } +.terminal-2571030914-r2 { fill: #0178d4 } +.terminal-2571030914-r3 { fill: #c5c8c6 } +.terminal-2571030914-r4 { fill: #6e7681 } +.terminal-2571030914-r5 { fill: #569cd6 } +.terminal-2571030914-r6 { fill: #cccccc } +.terminal-2571030914-r7 { fill: #dcdcaa } +.terminal-2571030914-r8 { fill: #9cdcfe } +.terminal-2571030914-r9 { fill: #b5cea8 } +.terminal-2571030914-r10 { fill: #1e1e1e } +.terminal-2571030914-r11 { fill: #7daf9c } +.terminal-2571030914-r12 { fill: #4ec9b0 } +.terminal-2571030914-r13 { fill: #ce9178 } - + - + - + - + - + - + - + - + - + - TextAreaSnapshot + TextAreaSnapshot - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -1  defhello(name): -2      x =123 -3  whilenotFalse:                      -4  print("hello "+ name)            -5  continue -6   - -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +1  defhello(name): +2  x = 123 +3  whilenotFalse:                      +4  print("hello " + name)            +5  continue +6   + +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_wrapping_and_folding.svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_wrapping_and_folding.svg index 974743334c..77e67337fe 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_wrapping_and_folding.svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_text_area_wrapping_and_folding.svg @@ -19,148 +19,147 @@ font-weight: 700; } - .terminal-2906974500-matrix { + .terminal-962782431-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2906974500-title { + .terminal-962782431-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2906974500-r1 { fill: #121212 } -.terminal-2906974500-r2 { fill: #0178d4 } -.terminal-2906974500-r3 { fill: #c5c8c6 } -.terminal-2906974500-r4 { fill: #c2c2bf } -.terminal-2906974500-r5 { fill: #272822 } -.terminal-2906974500-r6 { fill: #f92672;font-weight: bold } -.terminal-2906974500-r7 { fill: #f8f8f2 } -.terminal-2906974500-r8 { fill: #90908a } -.terminal-2906974500-r9 { fill: #f8f8f2;font-style: italic; } -.terminal-2906974500-r10 { fill: #000000 } + .terminal-962782431-r1 { fill: #121212 } +.terminal-962782431-r2 { fill: #0178d4 } +.terminal-962782431-r3 { fill: #c5c8c6 } +.terminal-962782431-r4 { fill: #c2c2bf } +.terminal-962782431-r5 { fill: #272822 } +.terminal-962782431-r6 { fill: #f8f8f2 } +.terminal-962782431-r7 { fill: #f92672;font-weight: bold } +.terminal-962782431-r8 { fill: #90908a } +.terminal-962782431-r9 { fill: #000000 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TextAreaWrapping + TextAreaWrapping - - - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - 1  # The  -Wonders  -of Space  -Explorati -on - 2   - 3  Space      -explorati  -on has     -*always* -captured   -the        -human      -imaginati  -on.        - 4  ▃▃ - 5  ダレンバ   -ーンズ     - 6   - 7   -Thisissom  -elongtext  -thatshoul  -dfoldcorr  -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + 1  #The  +Wonders  +of Space  +Explorati +on + 2   + 3  Space      +explorati  +on has     +*always*   +captured   +the        +human      +imaginati  +on.        + 4  ▃▃ + 5  ダレンバ   +ーンズ     + 6   + 7   +Thisissom  +elongtext  +thatshoul  +dfoldcorr  +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ diff --git a/tests/snapshot_tests/language_snippets.py b/tests/snapshot_tests/language_snippets.py index f0c6c77469..1c34d46648 100644 --- a/tests/snapshot_tests/language_snippets.py +++ b/tests/snapshot_tests/language_snippets.py @@ -705,104 +705,6 @@ class Rectangle { source config.sh """ -KOTLIN = """\ -// Variables -val name = "John" -var age = 30 -var isStudent = true - -// Printing variables -println("Hello, $name! You are $age years old.") - -// Conditional statements -when { - age >= 18 && isStudent -> println("You are an adult student.") - age >= 18 -> println("You are an adult.") - else -> println("You are a minor.") -} - -// Arrays -val numbers = arrayOf(1, 2, 3, 4, 5) -println("Numbers: ${numbers.contentToString()}") - -// Lists -val fruits = listOf("apple", "banana", "orange") -println("Fruits: $fruits") - -// Loops -for (num in numbers) { - println("Number: $num") -} - -// Functions -fun greet(name: String) { - println("Hello, $name!") -} -greet("Alice") - -// Lambda functions -val square = { num: Int -> num * num } -println("Square of 5: ${square(5)}") - -// Extension functions -fun String.reverse(): String { - return this.reversed() -} -val reversed = "Hello".reverse() -println("Reversed: $reversed") - -// Data classes -data class Person(val name: String, val age: Int) -val person = Person("John", 30) -println("Person: $person") - -// Null safety -var nullable: String? = null -println("Length: ${nullable?.length}") - -// Elvis operator -val length = nullable?.length ?: 0 -println("Length (Elvis): $length") - -// Smart casts -fun printLength(obj: Any) { - if (obj is String) { - println("Length: ${obj.length}") - } -} -printLength("Hello") - -// Object expressions -val comparator = object : Comparator { - override fun compare(a: Int, b: Int): Int { - return a - b - } -} -val sortedNumbers = numbers.sortedWith(comparator) -println("Sorted numbers: ${sortedNumbers.contentToString()}") - -// Companion objects -class MyClass { - companion object { - fun create(): MyClass { - return MyClass() - } - } -} -val obj = MyClass.create() - -// Sealed classes -sealed class Result { - data class Success(val data: String) : Result() - data class Error(val message: String) : Result() -} -val result: Result = Result.Success("Data") -when (result) { - is Result.Success -> println("Success: ${result.data}") - is Result.Error -> println("Error: ${result.message}") -} -""" - RUST = """\ use std::collections::HashMap; @@ -1016,6 +918,26 @@ class Rectangle implements Shape { } """ +XML = """\ + + + + + The Great Gatsby + F. Scott Fitzgerald + 1925 + + + + Sapiens: A Brief History of Humankind + Yuval Noah Harari + 2011 + + + + +""" + SNIPPETS = { "python": PYTHON, "markdown": MARKDOWN, @@ -1029,7 +951,7 @@ class Rectangle implements Shape { "go": GO, "javascript": JAVASCRIPT, "bash": BASH, - "kotlin": KOTLIN, "rust": RUST, "java": JAVA, + "xml": XML, } diff --git a/tests/snapshot_tests/test_snapshots.py b/tests/snapshot_tests/test_snapshots.py index a2deb57f16..caa74cb124 100644 --- a/tests/snapshot_tests/test_snapshots.py +++ b/tests/snapshot_tests/test_snapshots.py @@ -38,8 +38,8 @@ TabbedContent, TabPane, ) -from textual.widgets.text_area import BUILTIN_LANGUAGES, Selection, TextAreaTheme from textual.theme import Theme +from textual.widgets.text_area import BUILTIN_LANGUAGES, Selection, TextAreaTheme # These paths should be relative to THIS directory. WIDGET_EXAMPLES_DIR = Path("../../docs/examples/widgets") diff --git a/tests/text_area/test_languages.py b/tests/text_area/test_languages.py index ad3d4d0799..f5f381354f 100644 --- a/tests/text_area/test_languages.py +++ b/tests/text_area/test_languages.py @@ -2,11 +2,7 @@ from textual.app import App, ComposeResult from textual.widgets import TextArea -from textual.widgets.text_area import ( - Document, - LanguageDoesNotExist, - SyntaxAwareDocument, -) +from textual.widgets.text_area import LanguageDoesNotExist class TextAreaApp(App): @@ -54,6 +50,7 @@ async def test_setting_language_to_none(): assert text_area.language is None +@pytest.mark.syntax async def test_setting_unknown_language(): app = TextAreaApp() async with app.run_test(): @@ -70,24 +67,20 @@ async def test_register_language(): async with app.run_test(): text_area = app.query_one(TextArea) - from tree_sitter_languages import get_language - - language = get_language("elm") + from textual._tree_sitter import get_language + language = get_language("python") + assert language is not None # ...and register it with no highlights - text_area.register_language(language, "") - - # Ensure that registered language is now available. - assert "elm" in text_area.available_languages + text_area.register_language("python-test", language, "") - # Switch to the newly registered language - text_area.language = "elm" - - assert text_area.language == "elm" + assert "python-test" in text_area.available_languages + text_area.language = "python-test" + assert text_area.language == "python-test" @pytest.mark.syntax -async def test_register_language_existing_language(): +async def test_update_highlight_query(): app = TextAreaApp() async with app.run_test(): text_area = app.query_one(TextArea) @@ -96,32 +89,7 @@ async def test_register_language_existing_language(): assert len(text_area._highlights) > 0 # Overwriting the highlight query for Python... - text_area.register_language("python", "") + text_area.update_highlight_query("python", "") # We've overridden the highlight query with a blank one, so there are no highlights. assert text_area._highlights == {} - - -@pytest.mark.syntax -async def test_language_binary_missing(monkeypatch: pytest.MonkeyPatch): - # mock a failed installation of tree-sitter-language binaries by - # raising an OSError from get_language - def raise_oserror(_): - raise OSError( - "/path/to/tree_sitter_languages/languages.so: " - "cannot open shared object file: No such file or directory" - ) - - monkeypatch.setattr( - "textual.document._syntax_aware_document.get_language", raise_oserror - ) - - app = TextAreaApp() - async with app.run_test(): - text_area = app.query_one(TextArea) # does not crash - assert text_area.language == "python" - # resulting document is not a SyntaxAwareDocument and does not - # support highlights - assert isinstance(text_area.document, Document) - assert not isinstance(text_area.document, SyntaxAwareDocument) - assert text_area._highlights == {}