diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2023-12-24 10:00:20 +0100 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2024-01-19 16:58:37 +0100 |
| commit | 1ae9b0e4558fe7868f8cda2db65239cfb14836d0 (patch) | |
| tree | 4eea14b40b8b81d9388fb35cbc9e35b341a75c98 /tests/query/highlights/t32 | |
| parent | chore(tests): consistent captures (diff) | |
| download | nvim-treesitter-1ae9b0e4558fe7868f8cda2db65239cfb14836d0.tar nvim-treesitter-1ae9b0e4558fe7868f8cda2db65239cfb14836d0.tar.gz nvim-treesitter-1ae9b0e4558fe7868f8cda2db65239cfb14836d0.tar.bz2 nvim-treesitter-1ae9b0e4558fe7868f8cda2db65239cfb14836d0.tar.lz nvim-treesitter-1ae9b0e4558fe7868f8cda2db65239cfb14836d0.tar.xz nvim-treesitter-1ae9b0e4558fe7868f8cda2db65239cfb14836d0.tar.zst nvim-treesitter-1ae9b0e4558fe7868f8cda2db65239cfb14836d0.zip | |
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"
(https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/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`
Diffstat (limited to 'tests/query/highlights/t32')
| -rw-r--r-- | tests/query/highlights/t32/keywords.cmm | 20 | ||||
| -rw-r--r-- | tests/query/highlights/t32/literals.cmm | 10 | ||||
| -rw-r--r-- | tests/query/highlights/t32/var.cmm | 2 |
3 files changed, 16 insertions, 16 deletions
diff --git a/tests/query/highlights/t32/keywords.cmm b/tests/query/highlights/t32/keywords.cmm index a4013d72f..f04df3ed1 100644 --- a/tests/query/highlights/t32/keywords.cmm +++ b/tests/query/highlights/t32/keywords.cmm @@ -3,15 +3,15 @@ PRIVATE &password ; ^ @variable.builtin ENTRY &password ; <- @keyword -; ^ @parameter +; ^ @variable.parameter ENTRY %LINE &salt ; <- @keyword ; ^ @constant.builtin -; ^ @parameter +; ^ @variable.parameter IF "&password"=="" -; <- @conditional +; <- @keyword.conditional ; ^ @string ; ^ @variable.builtin ; ^ @operator @@ -21,7 +21,7 @@ IF "&password"=="" ; ^ @keyword.return ) ELSE -; <- @conditional +; <- @keyword.conditional ( PRIVATE &pass @@ -33,9 +33,9 @@ ELSE GOSUB verify_password "&password" ; ^ @function.call RETURNVALUES &pass -; ^ @parameter +; ^ @variable.parameter WAIT 10.ms -; ^ @float +; ^ @number.float ) IF !&pass @@ -63,7 +63,7 @@ FramePOS ,,,,Maximized ; ^ @punctuation.delimiter ; ^ @constant.builtin WinPOS 0% 50% 100% 35% -; ^ @float +; ^ @number.float COVerage.ListFunc ENDDO @@ -80,11 +80,11 @@ verify_password: ; <- @function ( PARAMETERS &password -; ^ @parameter +; ^ @variable.parameter SYStem.Option.KEYCODE "&password" SYStem.JtagClock 1kHz -; ^ @float +; ^ @number.float SYStem.Mode.Attach Data.Set N: EAXI:0x34000000 %Long 0x34000100 0x34000021 /verify @@ -107,7 +107,7 @@ SUBROUTINE start_debug COVerage.ListModule %MULTI.OBC \sieve ; ^ @keyword ; ^ @constant.builtin -; ^ @symbol +; ^ @string.special.symbol Var.DRAW flags[0..16] /Alternate 3 ; ^ @keyword diff --git a/tests/query/highlights/t32/literals.cmm b/tests/query/highlights/t32/literals.cmm index 8c63ce96d..a9d72e441 100644 --- a/tests/query/highlights/t32/literals.cmm +++ b/tests/query/highlights/t32/literals.cmm @@ -8,19 +8,19 @@ sYmbol.NEW _InitialSP 0x34000100 ; ^ @number DO ~~~~/test.cmm -; ^ @string.special +; ^ @string.special.path WAIT 1.ns -; ^ @float +; ^ @number.float SYStem.JtagClock 100.GHZ -; ^ @float +; ^ @number.float DATA.SET P:&HEAD+0x4 %LONG DATA.LONG(EA:&HEAD+0x4)&0xFFFFFF ; ^ @constant.builtin List `main` -; ^ @symbol +; ^ @string.special.symbol &range = 'a'--'z'||'0'--'9' ; ^ @character @@ -34,6 +34,6 @@ Data.Set N: 0xffff800000 0y0011xx01xx&&a ; ^ @operator WinPOS 0% 85% 100% 15% -; ^ @float +; ^ @number.float // vim: set ft=t32: diff --git a/tests/query/highlights/t32/var.cmm b/tests/query/highlights/t32/var.cmm index de67278a0..8e251afef 100644 --- a/tests/query/highlights/t32/var.cmm +++ b/tests/query/highlights/t32/var.cmm @@ -34,7 +34,7 @@ Var.Assign (*ap)[2..4] = &a Var.Assign sp = &s.n+offset ; ^ @variable ; ^ @variable -; ^ @field +; ^ @variable.member ; ^ @variable Var.Assign padd = (CAddition const * volatile)&d ; ^ @variable |
