mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-14 17:30:08 -04:00
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`
This commit is contained in:
parent
10dd49958c
commit
1ae9b0e455
263 changed files with 2356 additions and 2337 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue