Commit graph

152 commits

Author SHA1 Message Date
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
Riley Bruins
28a914eb57 fix(php): parameter and operator touch-ups 2024-04-25 12:04:50 +02:00
Mark McCulloh
40e8c92f99
fix(wing): update to new repo (#6446) 2024-04-14 15:53:37 +00:00
Sergio A. Vargas
d2f4c78303
fix(julia): adapt queries to grammar changes (#6429) 2024-04-14 14:23:46 +02:00
Christian Clason
bfa217af76 Revert "ci(tests): drop flaky wing parser tests"
This reverts commit f08a9d97f7.

(Fixed by skipping bindings when generating.)
2024-04-14 13:36:22 +02:00
Christoph Sax
f22f024e78
feat(t32): update queries from upstream (#6440)
Adds support for new node type `elif_block`.
2024-04-14 12:58:21 +02:00
Christian Clason
f08a9d97f7 ci(tests): drop flaky wing parser tests 2024-04-13 20:04:38 +02:00
Riley Bruins
e9321bb914
feat(nix): misc cleanups + comment injection (#6418)
* fix(nix): highlight strings within interpolations

* feat(nix): move `derivation` to function.builtin

* fix(nix): removes all `priority` workarounds

* feat(nix): arbitrary injections using `#` comments
2024-04-09 14:20:26 +09:00
Caleb White
4ebf4ca4fa chore(php): trim down tests 2024-03-27 08:29:44 +01:00
Caleb White
7d938c1c72 fix(php): fix use_{as,instead_of}_clause highlights 2024-03-27 08:29:44 +01:00
Caleb White
3400788705 feat(php): add highlight tests 2024-03-27 08:29:44 +01:00
Noah
03f650705c
Update Clojure highlights to be metadata aware (#6213) 2024-03-19 22:10:41 +01:00
Jaehwang Jung
dccf31f9b1 feat(highlights)!: @keyword.storage@keyword.modifier 2024-03-16 20:51:16 +08:00
Jaehwang Jung
998b230a77 feat(highlights)!: keyword @type.qualifier@keyword.modifier 2024-03-16 20:51:16 +08:00
Christian Clason
99ddf57353
feat(highlights)!: enforce documented captures (#6232)
Problem: Allowing undocumented "secret" (sub)captures makes it harder
to write comprehensive colorschemes and catch inconsistent captures.

Solution: Only allow captures listed in CONTRIBUTING.md. Add useful
(cross-language) subcaptures and drop language-specific or too niche
ones.

Follow-up: Adding further `*.builtin` captures and changing queries to
use them.

Language-specific subcaptures should instead be added in user config or
a custom language plugin.
2024-03-03 11:00:11 +01:00
Riley Bruins
127cf25737 feat(latex): pre-compiled header highlights, tests
Also moves comment highlights to the very end to make them more
future-proof.
2024-02-06 10:29:09 +01:00
ObserverOfTime
fa38f4e6f9 fix(highlights): improve member/property distinction 2024-01-19 16:58:37 +01:00
Christian Clason
1ae9b0e455 feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.

Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.

Specifically:

* tree-sitter "standard capture names"
  (3f44b89685/highlight/src/lib.rs (L20-L72)):

  - `@parameter` -> `@variable.parameter`
  - `@field` -> `@variable.member`
  - `@namespace` -> `@module`
  - `@float` -> `@number.float`
  - `@symbol` -> `@string.special.symbol`
  - `@string.regex` -> `@string.regexp`
  - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
  - `@text.title` -> `@markup.heading`
  - `@text.literal` -> `@markup.raw`
  - `@text.reference` -> `@markup.link`
  - `@text.uri` -> `@markup.link.url` (in markup links)
  - `@string.special` -> `@markup.link.label` (non-url links)
  - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)

* Helix captures
  (https://docs.helix-editor.com/master/themes.html#syntax-highlighting):

  - `@method` -> `@function.method`
  - `@method.call` -> `@function.method.call`
  - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
  - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
  - `@text.uri` -> `@string.special.url` (outside markup)
  - `@preproc` -> `@keyword.directive`
  - `@define` -> `@keyword.directive`(`.define`?)
  - `@storageclass` -> `@keyword.storage`
  - `@conditional` -> `@keyword.conditional`
  - `@debug` -> `@keyword.debug`
  - `@exception` -> `@keyword.exception`
  - `@include` -> `@keyword.import`
  - `@repeat` -> `@keyword.repeat`

* cleanup

  - remove some redundant `@conceal` (but still allow it for conceal-only patterns)
  - remove obsolete `@error` (syntax linting is out of scope for this repo)
  - sort, cleanup capture list in `CONTRIBUTING.md`
2024-01-19 16:58:37 +01:00
Christian Clason
10dd49958c chore(tests): consistent captures 2024-01-19 16:58:37 +01:00
Marc Jakobi
5240574bcb
feat(haskell): tweak highlights
* add cases for `qualified_variable`

* add function defined in terms of composition
2023-11-18 19:02:29 -05:00
Mark McCulloh
17e77749c1
fix(wing): update parser and queries, add maintainer (#5671) 2023-11-13 19:04:27 +00:00
Pham Huy Hoang
80f66cdef1
injections(vue): inject typescript instead of js (#5577)
Interpolations (`{{valid js code}}`) and directive attributes
(`<element :directive="valid js code"`) can also be typescript code,
hence we can inject typescript instead of javascript here and still
be ok with highlights (bar some syntax differences between ts and js)
2023-11-06 11:04:13 +09:00
Marc Jakobi
d33dbdab01 feat(haskell): highlights improvements
- Consider functions with only one value on the rhs as variables
- Applied composition: `(f . g) <param>` -> `@function.call`
- View patterns
- `@field` in record update expression
- type_tuple and type_list as variables
- quantifier for `exp_apply (<rhs>)+ (variable)`
- type_tuple and type_list as variables
- Treat signatures with only one value on the rhs as variables
  (except for `IO a`) -> Fixes #5505.
- Remove redundant anchors from signature function queries.
- Move signature function queries to give them higher priority
- Scoped function types
- Add signature query to function with parameters query
2023-10-15 14:32:51 -04:00
Marc Jakobi
783e5fc307
feat(nix): some highlight improvements
- functions
- builtin functions with prefix
- add test file
2023-10-12 19:04:55 +00:00
Marc Jakobi
0eb1a0ad1c
fix(haskell): prevent segfault due to anchorless queries (#5502) 2023-10-10 17:12:36 +09:00