nvim-treesitter/runtime/queries/thrift/highlights.scm

238 lines
3.2 KiB
Scheme
Raw Permalink Normal View History

; Variables
((identifier) @variable
(#set! priority 95))
2023-01-21 07:39:15 -05:00
; Includes
2023-01-28 15:47:47 -05:00
[
"include"
2023-01-21 07:39:15 -05:00
"cpp_include"
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`
2023-12-24 10:00:20 +01:00
] @keyword.import
2023-01-21 07:39:15 -05:00
; Function
(function_definition
(identifier) @function)
2023-01-21 07:39:15 -05:00
; Fields
2024-01-06 15:05:50 +09:00
(field
(identifier) @property)
2023-01-21 07:39:15 -05:00
; Parameters
(function_definition
(parameters
2024-01-06 15:05:50 +09:00
(parameter
(identifier) @variable.parameter)))
2023-01-21 07:39:15 -05:00
(throws
(parameters
2024-01-06 15:05:50 +09:00
(parameter
(identifier) @variable.parameter)))
2023-01-21 07:39:15 -05:00
; Types
(typedef_identifier) @type
2024-01-06 15:05:50 +09:00
(struct_definition
2024-01-06 15:05:50 +09:00
"struct"
(identifier) @type)
2023-01-21 07:39:15 -05:00
(union_definition
2024-01-06 15:05:50 +09:00
"union"
(identifier) @type)
2023-01-21 07:39:15 -05:00
(exception_definition
2024-01-06 15:05:50 +09:00
"exception"
(identifier) @type)
(service_definition
2024-01-06 15:05:50 +09:00
"service"
(identifier) @type)
(interaction_definition
2024-01-06 15:05:50 +09:00
"interaction"
(identifier) @type)
2023-01-21 07:39:15 -05:00
(type
type: (identifier) @type)
(definition_type
type: (identifier) @type)
((identifier) @type
(#lua-match? @type "^[_]*[A-Z]"))
2023-01-21 07:39:15 -05:00
; Constants
2024-01-06 15:05:50 +09:00
(const_definition
(identifier) @constant)
((identifier) @constant
(#lua-match? @constant "^[_A-Z][A-Z0-9_]*$"))
2024-01-06 15:05:50 +09:00
(enum_definition
type: (identifier) @type)
(enum_definition
2024-01-06 15:05:50 +09:00
"{"
(identifier) @constant)
2024-01-06 15:05:50 +09:00
; Builtin Types
[
(primitive)
"list"
"map"
"set"
"sink"
"stream"
"void"
] @type.builtin
; Namespace
(namespace_declaration
(namespace_scope) @string.special)
(namespace_declaration
(namespace_scope)
2024-01-06 15:05:50 +09:00
[
type: (namespace) @module
2024-01-06 15:05:50 +09:00
(_
(identifier) @module)
])
; Attributes
(annotation_definition
2024-01-06 15:05:50 +09:00
(annotation_identifier
(identifier) @attribute))
(fb_annotation_definition
2024-01-06 15:05:50 +09:00
"@" @attribute
(annotation_identifier
(identifier) @attribute)
(identifier)? @attribute)
2024-01-06 15:05:50 +09:00
(namespace_uri
(string) @attribute)
2023-01-21 07:39:15 -05:00
2024-01-06 15:05:50 +09:00
; Operators
2023-01-21 07:39:15 -05:00
[
"="
"&"
2023-01-21 07:39:15 -05:00
] @operator
; Exceptions
2024-01-06 15:05:50 +09:00
"throws" @keyword.exception
2023-01-21 07:39:15 -05:00
; Keywords
[
"exception"
"extends"
"typedef"
"uri"
2023-01-21 07:39:15 -05:00
] @keyword
2024-04-23 12:23:15 -07:00
[
"enum"
"struct"
"union"
"senum"
"interaction"
"namespace"
"service"
] @keyword.type
; Deprecated Keywords
2023-01-21 07:39:15 -05:00
[
"cocoa_prefix"
"cpp_namespace"
"csharp_namespace"
"delphi_namespace"
"java_package"
"perl_package"
"php_namespace"
"py_module"
"ruby_namespace"
"smalltalk_category"
"smalltalk_prefix"
"xsd_all"
"xsd_attrs"
"xsd_namespace"
"xsd_nillable"
"xsd_optional"
] @keyword
2023-03-21 13:50:54 +08:00
; Extended Keywords
[
"package"
"performs"
] @keyword
[
"async"
"oneway"
] @keyword.coroutine
; Qualifiers
2023-01-28 15:47:47 -05:00
[
"client"
"const"
2023-01-28 15:47:47 -05:00
"idempotent"
"optional"
2023-01-28 15:47:47 -05:00
"permanent"
"readonly"
"required"
2023-01-28 15:47:47 -05:00
"safe"
"server"
2023-01-28 15:47:47 -05:00
"stateful"
"transient"
] @keyword.modifier
2023-01-21 07:39:15 -05:00
; Literals
(string) @string
2023-01-28 15:47:47 -05:00
(escape_sequence) @string.escape
2023-01-21 07:39:15 -05:00
(namespace_uri
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`
2023-12-24 10:00:20 +01:00
(string) @string.special.url)
2023-01-21 07:39:15 -05:00
(number) @number
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`
2023-12-24 10:00:20 +01:00
(double) @number.float
2023-01-21 07:39:15 -05:00
(boolean) @boolean
; Typedefs
(typedef_identifier) @type.definition
2023-01-21 07:39:15 -05:00
2023-01-28 15:47:47 -05:00
; Punctuation
2024-01-06 15:05:50 +09:00
"*" @punctuation.special
2023-01-28 15:47:47 -05:00
2023-01-21 07:39:15 -05:00
[
2024-01-06 15:05:50 +09:00
"{"
"}"
"("
")"
"["
"]"
"<"
">"
] @punctuation.bracket
2023-01-21 07:39:15 -05:00
[
"."
2023-01-21 07:39:15 -05:00
","
";"
":"
2023-01-21 07:39:15 -05:00
] @punctuation.delimiter
; Comments
(comment) @comment @spell
((comment) @comment.documentation
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
((comment) @comment.documentation
(#lua-match? @comment.documentation "^///[^/]"))
2024-01-06 15:05:50 +09:00
((comment) @comment.documentation
(#lua-match? @comment.documentation "^///$"))
((comment) @keyword.directive @nospell
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`
2023-12-24 10:00:20 +01:00
(#lua-match? @keyword.directive "#!.*"))