Commit graph

15 commits

Author SHA1 Message Date
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
Omar Valdez
8a74ac9aea feat(python): highlight modules 2024-11-21 16:48:16 +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
Amaan Qureshi
87faf372eb fix(python,starlark): builtin types should come after types 2023-04-25 03:04:05 -04:00
Amaan Qureshi
01b42a1a57 feat(python,starlark): highlight type conversions as @function.macro 2023-04-25 03:04:05 -04:00
Amaan Qureshi
5ab25d8a1f fix(python,starlark): update field match pattern 2023-04-25 03:04:05 -04:00
Santos Gallegos
f1373051e5
Python: highlight future import (#2936)
* Python: highlight future import

* Use constant.builtin
2022-05-13 21:46:06 +00:00
Santos Gallegos
132405f18f Python: highlight raise from statement 2022-05-01 10:06:13 +02:00
Stephan Seitz
b8d1c2445a highlights(python): "from" in yield should be @keyword.return
Fixes #2712
2022-04-01 17:00:21 +02:00
Stephan Seitz
c4e3564ea3 highlights(python): add support for pattern matching
Fixes #2080
Depends on https://github.com/tree-sitter/tree-sitter-python/pull/140
2022-01-28 19:11:20 +01:00