nvim-treesitter/queries/sparql/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

211 lines
2.4 KiB
Scheme

[
(path_mod)
"||"
"&&"
"="
"<"
">"
"<="
">="
"+"
"-"
"*"
"/"
"!"
"|"
"^"
] @operator
[
"_:"
(namespace)
] @module
[
"UNDEF"
"a"
] @variable.builtin
[
"ADD"
"ALL"
"AS"
"ASC"
"ASK"
"BIND"
"BY"
"CLEAR"
"CONSTRUCT"
"COPY"
"CREATE"
"DEFAULT"
"DELETE"
"DELETE DATA"
"DELETE WHERE"
"DESC"
"DESCRIBE"
"DISTINCT"
"DROP"
"EXISTS"
"FILTER"
"FROM"
"GRAPH"
"GROUP"
"HAVING"
"INSERT"
"INSERT DATA"
"INTO"
"LIMIT"
"LOAD"
"MINUS"
"MOVE"
"NAMED"
"NOT"
"OFFSET"
"OPTIONAL"
"ORDER"
"PREFIX"
"REDUCED"
"SELECT"
"SERVICE"
"SILENT"
"UNION"
"USING"
"VALUES"
"WHERE"
"WITH"
] @keyword
(string) @string
(echar) @string.escape
(integer) @number
[
(decimal)
(double)
] @number.float
(boolean_literal) @boolean
[
"BASE"
"PREFIX"
] @keyword
[
"ABS"
"AVG"
"BNODE"
"BOUND"
"CEIL"
"CONCAT"
"COALESCE"
"CONTAINS"
"DATATYPE"
"DAY"
"ENCODE_FOR_URI"
"FLOOR"
"HOURS"
"IF"
"IRI"
"LANG"
"LANGMATCHES"
"LCASE"
"MD5"
"MINUTES"
"MONTH"
"NOW"
"RAND"
"REGEX"
"ROUND"
"SECONDS"
"SHA1"
"SHA256"
"SHA384"
"SHA512"
"STR"
"SUM"
"MAX"
"MIN"
"SAMPLE"
"GROUP_CONCAT"
"SEPARATOR"
"COUNT"
"STRAFTER"
"STRBEFORE"
"STRDT"
"STRENDS"
"STRLANG"
"STRLEN"
"STRSTARTS"
"STRUUID"
"TIMEZONE"
"TZ"
"UCASE"
"URI"
"UUID"
"YEAR"
"isBLANK"
"isIRI"
"isLITERAL"
"isNUMERIC"
"isURI"
"sameTerm"
] @function.builtin
[
"."
","
";"
] @punctuation.delimiter
[
"("
")"
"["
"]"
"{"
"}"
(nil)
(anon)
] @punctuation.bracket
[
"IN"
("NOT" "IN")
] @keyword.operator
(comment) @comment @spell
; Could this be summarized?
(select_clause
[
bound_variable: (var)
"*"
] @variable.parameter)
(bind bound_variable: (var) @variable.parameter)
(data_block bound_variable: (var) @variable.parameter)
(group_condition bound_variable: (var) @variable.parameter)
(iri_reference ["<" ">"] @module)
(lang_tag) @type
(rdf_literal
"^^" @type
datatype: (_ ["<" ">" (namespace)] @type) @type)
(function_call identifier: (_) @function)
(function_call identifier: (iri_reference ["<" ">"] @function))
(function_call identifier: (prefixed_name (namespace) @function))
(base_declaration (iri_reference ["<" ">"] @variable))
(prefix_declaration (iri_reference ["<" ">"] @variable))
[
(var)
(blank_node_label)
(iri_reference)
(prefixed_name)
] @variable