Commit graph

176 commits

Author SHA1 Message Date
Valentin Krasontovitsch
b760eef0ba
fix(dockerfile): correct bash syntax highlighting
when a dockerfile contains several RUN statements, the syntax
highlighting would sometimes run over and encompass dockerfile
statements after the RUN command (typically everything between the first
and last RUN statement, though the bash syntax bleed can be broken by
terminating a RUN statement with a semicolon, or a space 🙄)

we fix this by using a slightly different approach to recognizing /
grouping (the content of) RUN commands:

- instead of having shell_command at the top level of the block we
  changed, we're using run_instruction - so parsing happens per `RUN`
  statement, which is really what we want
- inseade of `injection.combined`, we use `injection.include-children`,
  which combines all the shell fragments (the text parts of a shell
  command, including after newline continuations), which is really what
  we want, as that's all the text of a RUN statement

that fixes the highlight bleed, and preserves correct highlighting for
each RUN statement.

we also add a regression test for highlighting.

Closes #6530, #6975
2026-03-12 23:30:55 +01:00
stefan
cc12e37e5b fix(nix): make all bash injections combined 2026-01-29 10:41:43 +01:00
Riley Bruins
5e8652dbaf fix(usd): misc punctuation highlights 2026-01-08 10:17:12 +01:00
Chris Dragan
6feaebb456
feat(kos): highlights improvements (#8404)
* Mark floats as number.float
* Mark function arguments as variable.parameter
* Mark _ placeholder as character.special
* Mark string interpolation delimiters as punctuation.special
2026-01-07 21:53:42 -08:00
Chris Dragan
31fc7e10cd
feat: add kos parser and queries (#8389) 2026-01-04 11:08:07 +01:00
Marc Jakobi
7efc1b58a8
fix(nix): refactor nixosTest injections for better performance (#8378) 2025-12-29 16:47:03 +01:00
Marc Jakobi
7ba26e7685 perf(nix): replace match with lua-match 2025-12-26 22:13:05 +01:00
Christian Clason
d2350758b3 feat(parsers)!: remove gitlab-hosted blueprint, fusion, jsonc
Problem: Gitlab has too frequent outages, which break automation.

Solution: Drop all Gitlab-hosted parsers (two of which have been
unmaintained for years).
2025-12-06 18:10:39 +01:00
Christian Clason
41913a8d44 feat(bash): update parser
Breaking change: removed double parenthesis as valid opening to
arithmetic expansion. (Only `$((` is allowed according to the manual.)
2025-12-06 14:04:19 +01:00
Christoph Sax
b50774079a
feat(t32)!: update parser and queries (#8276)
`trace32_hll_variable` has been removed from the grammar. The
queries are now capturing `symbol` instead. `symbol` is highlighted
as variable or constant.
2025-11-12 10:06:04 +01:00
George Harker
1ddb266477
feat(parsers): add zsh support (#8240)
Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Co-authored-by: Riley Bruins <ribru17@hotmail.com>
Co-authored-by: Tayfun Bocek <tayfunbocek@live.ca>
2025-11-05 20:13:53 -08:00
Tayfun Bocek
64f4755b9d
feat!(gdshader): replace gdshader parser and queries (#8244)
Switch parser to https://github.com/airblast-dev/tree-sitter-gdshader
2025-10-30 14:59:19 +01:00
Lev Velykoivanenko
c53bb10a71
fix(python): regex injection not working for concatenated strings (#8197)
Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-10-26 09:25:42 -07:00
Riley Bruins
8fccdb3d49 feat(proto): more delimiter, property highlights 2025-08-31 08:06:48 +02:00
Robert Muir
a4fa3e2d18 Revert "fix(jinja): remove crashing pattern"
This reverts commit 8c8742871a.
2025-08-05 20:06:49 +02:00
Christian Clason
8c8742871a fix(jinja): remove crashing pattern
https://github.com/cathaysia/tree-sitter-jinja/issues/37
2025-07-21 11:21:52 +02:00
Robert Muir
20d77c2e5b fix(jinja): assign highlights to all variables and functions
The majority of jinja variables aren't assigned any highlights at all.
Assign @variable to all identifiers.

Jinja filters without parameters are not highlighted as functions: add a
query for these.

Refine the existing @variable.member to only capture identifiers instead
of broader nodes.
2025-07-19 18:25:47 +02:00
Christian Clason
53dccb3a77 feat(tests)!: new infrastructure based on makefile
Problem: Not easy to run all checks and tests locally. Redundant CI
workflows.

Solution: Separate CI into two workflows:
 * lint: Lua files (stylua, luals), query files (valid captures,
   predicates, directives using tsqueryls), docs
   (SUPPORTED_LANGUAGES.md) -- does not need parser installation
 * tests: parsers (ABI compatibility), query files (tsqueryls on
   Linux/macOS; nvim on Windows), highlight and indent tests (separated
   for better readability) -- needs parser installation (but only once)

Switch to https://github.com/nvim-treesitter/highlight-assertions fork
with ABI 15 support.

Run all tests (on Linux and macOS) through `make` (`formatlua`,
`checklua`, `lintquery`, `formatquery`, `checkquery`, `docs`, `tests`),
which downloads and caches all necessary dependencies.

Remove `update-readme` workflow (replaced by lint job on PRs).
2025-05-12 18:43:41 +02:00
Christian Clason
75ee7ff2f0 tests(gleam): fix assert tests that no longer parse correctly 2025-05-12 18:43:40 +02:00
Christian Clason
cbfe8a20c7 feat(html): use gsub for mimetype lookup 2025-05-12 18:43:40 +02:00
Christian Clason
c17de56890 feat!: track parser revision in Lua
Problem: Tracking parser revision in lockfile and allowing override
through the parsers module complicates the code. In addition, only
revision changes are handled robustly, not changes to other installation
info.

Solution: Track parser revision in the parsers module directly. Reload
parser table on every install or update call. Support modifying parser
table in a `User TSUpdate` autocommand.
2025-05-12 18:43:40 +02:00
Pham Huy Hoang
3966b8808b fix!: indents now rely on treesitter highlight
- Apply suggestions from Lewis to only parse visible lines
- Fix failed tests
2025-05-12 18:43:40 +02:00
Christian Clason
692b051b09 feat!: drop modules, general refactor and cleanup 2025-05-12 18:43:40 +02:00
Marc Jakobi
628d5e442c injections(nix): add nixosTest.testScript + home-manager nvim config
(+ add Check to mkDerivation bash matches)

(+ add Check to mkDerivation bash matches)
2025-05-12 18:43:40 +02:00
Mikkel Mondrup Kristensen
0e21ee8df6
More bash injection support for Taskfile (#7805) 2025-04-07 21:08:22 +02:00
Anthony Fiddes
205faba176
feat(yaml): inject bash for taskfiles (#7804) 2025-04-06 19:09:27 +02:00
Jakob Zahn
997288c552
fix(python): highlight all types of docstrings (#7788) 2025-04-03 09:35:41 +02:00
dcho
d0a56e3677 fix(python): prioritize builtin functions 2025-03-21 08:58:45 +01:00
Salomon Popp
683816f147
fix(python): don't highlight parameter name as builtin (#7732) 2025-03-13 09:21:55 +01:00
Salomon Popp
1a314a58d6
fix(python): highlight function calls correctly (#7728) 2025-03-12 09:22:33 +01:00
Salomon Popp
cf0eabc16c
fix(python): don't highlight attribute name as builtin (#7712)
* fix(python): don't highlight attribute name as builtin

* fix(python): highlight `@variable.member` correctly for member access context

* test: add test

* test: expand test

* docs: update comment

* refactor: change order, remove priority override

* style: remove extra newline
2025-03-11 08:48:33 +01:00
Caleb White
081a99b3be feat(php): add support for new relative_name node 2025-02-26 17:01:57 +01:00
Daniil Leontev
d2ff400641
feat(promql): do not use regex for string labels (#7669)
In Prometheus, label values are treated as strings when used with the
`=` and `!=` operators, and as regular expressions when used with the
`=~` and `!~` operators.

Injecting and then highlighting all label values as regex leads to a
situation where entirely valid **string** label values containing regex
special characters are mistakenly parsed and highlighted as regex. This
results in syntax errors, causing labels to be highlighted incorrectly.

For example, in `foo{bar=~"[a-z]{1,3}"}`, `{` and `}` are regex special
characters, so regex highlighting is expected. However, in
`foo{path="/foo/{id}"}`, `{` and `}` are just part of the string and
have no special meaning, so the whole value should be highlighted as a
string.
2025-02-20 12:17:32 +01:00
Caleb White
6cb4098d51 fix(php): properly highlight grouped imported functions and constants 2025-01-02 19:13:44 +01:00
Derek Stride
a295ba13d2
feat(ruby): add injection for debugger command strings (#7480) 2024-12-30 11:14:03 +01:00
Fredrik Ekre
3f377c0739 fix(julia): treat :: as operator in type contexts
This patch captures `::` as `@operator` within
`(unary_typed_expression)` and `(typed_expression)`. These should be the
only two cases that the parser can emit when encountering `::` in the
source, but as a fallback it is still captured as `@punctuation` in all
other cases.

The reasons for capturing `::` as an operator are i) the close relation
with the other type-operators `<:` and `>:` and ii) the fact that it is
treated as an operator by the Julia parser, just like `<:` and `>:`.
2024-11-23 11:10:05 +01:00
Riley Bruins
2d5c122af9 feat(http): more comprehensive highlights 2024-11-22 08:56:14 +01:00
Omar Valdez
8a74ac9aea feat(python): highlight modules 2024-11-21 16:48:16 +01:00
Riley Bruins
01a92da438 fix(rust): highlight parameters with ref in definition 2024-11-03 11:46:40 +01:00
Riley Bruins
679883ad31
feat(gleam,luau): use @keyword.type captures (#7181) 2024-09-26 09:09:41 +02:00
Riley Bruins
e090c5b22d feat(wing): add many missing highlights
...as well as some fold and injection queries.
2024-09-02 09:55:48 +02:00
Caleb White
ec8776ed9e
feat(php): php 8.4 support (#6741)
* chore(php): update maintainers

* feat(php): update php rules, highlight imported functions/consts

* feat(php): indent inside property hooks

* chore: update php and php_only revision
2024-08-18 12:30:04 +02:00
Riley Bruins
7cec6219c4 fix(query): properly apply predicate injections
I think these have been broken since the query parser update. Basically
the inner node for the string content was preventing injections because
include-children was not set.
2024-07-27 17:17:26 +02:00
Riley Bruins
f0e3b5c5fe fix(r): resolve highlight regressions 2024-06-29 09:26:53 +02:00
Christian Clason
5373c90c55 feat(r)!: update parser and queries 2024-06-27 15:31:41 +02:00
Louis Pilfold
09953e394b
fix(gleam): remove incorrect builtin highlight (#6757) 2024-06-17 07:23:06 -07:00
Riley Bruins
f9773e4a5e
test: fix tests broken after 0.10 update (#6714) 2024-06-01 12:33:56 +09:00
Caleb White
6f54846f2b feat(php): add highlights for scoped_property_access 2024-05-14 00:05:03 -04:00
Marc Jakobi
da0efd7398
fix(haskell): update queries and tests for rewritten parser (#6580) 2024-05-07 07:27:44 +00:00
Riley Bruins
f58cae6c22 feat: more @keyword.type captures 2024-05-01 09:59:50 +02:00