nvim-treesitter/queries/kconfig/highlights.scm
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

79 lines
1,008 B
Scheme

"source" @keyword.import
[
"mainmenu"
"config"
"menuconfig"
"choice"
"endchoice"
"comment"
"menu"
"endmenu"
"prompt"
"default"
"range"
"help"
(optional)
(modules)
] @keyword
[
"if"
"endif"
"depends on"
"select"
"imply"
"visible if"
] @keyword.conditional
[
"def_bool"
"def_tristate"
] @keyword.function
[
"||"
"&&"
"="
"!="
"<"
">"
"<="
">="
"!"
] @operator
[
"bool"
"tristate"
"int"
"hex"
"string"
] @type.builtin
[ "(" ")" ] @punctuation.bracket
(macro_variable ["$(" ")"] @punctuation.special)
(symbol) @variable
[
(prompt)
(macro_content)
(text)
] @string
(config name: (symbol) @constant)
(menuconfig name: (symbol) @constant)
(choice name: (symbol) @constant)
((symbol) @constant
(#lua-match? @constant "[A-Z0-9]+"))
(mainmenu name: (prompt) @markup.heading)
(comment_entry name: (prompt) @markup.heading)
(menu name: (prompt) @markup.heading)
(source (prompt) @string.special.url)
(comment) @comment @spell