mirror of
https://github.com/helix-editor/helix.git
synced 2024-09-11 18:58:00 +03:00
Add language support for Cap’n Proto format (#6325)
This commit is contained in:
parent
9f5374bf47
commit
ac2a7731a6
@ -10,6 +10,7 @@
|
|||||||
| c | ✓ | ✓ | ✓ | `clangd` |
|
| c | ✓ | ✓ | ✓ | `clangd` |
|
||||||
| c-sharp | ✓ | ✓ | | `OmniSharp` |
|
| c-sharp | ✓ | ✓ | | `OmniSharp` |
|
||||||
| cairo | ✓ | | | |
|
| cairo | ✓ | | | |
|
||||||
|
| capnp | ✓ | | ✓ | |
|
||||||
| clojure | ✓ | | | `clojure-lsp` |
|
| clojure | ✓ | | | `clojure-lsp` |
|
||||||
| cmake | ✓ | ✓ | ✓ | `cmake-language-server` |
|
| cmake | ✓ | ✓ | ✓ | `cmake-language-server` |
|
||||||
| comment | ✓ | | | |
|
| comment | ✓ | | | |
|
||||||
|
@ -2328,3 +2328,16 @@ roots = []
|
|||||||
[[grammar]]
|
[[grammar]]
|
||||||
name = "rst"
|
name = "rst"
|
||||||
source = { git = "https://github.com/stsewd/tree-sitter-rst", rev = "25e6328872ac3a764ba8b926aea12719741103f1" }
|
source = { git = "https://github.com/stsewd/tree-sitter-rst", rev = "25e6328872ac3a764ba8b926aea12719741103f1" }
|
||||||
|
|
||||||
|
[[language]]
|
||||||
|
name = "capnp"
|
||||||
|
scope = "source.capnp"
|
||||||
|
injection-regex = "capnp"
|
||||||
|
file-types = ["capnp"]
|
||||||
|
roots = []
|
||||||
|
comment-token = "#"
|
||||||
|
indent = { tab-width = 2, unit = " " }
|
||||||
|
|
||||||
|
[[grammar]]
|
||||||
|
name = "capnp"
|
||||||
|
source = { git = "https://github.com/amaanq/tree-sitter-capnp", rev = "fc6e2addf103861b9b3dffb82c543eb6b71061aa" }
|
||||||
|
14
runtime/queries/capnp/folds.scm
Normal file
14
runtime/queries/capnp/folds.scm
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[
|
||||||
|
(annotation_targets)
|
||||||
|
(const_list)
|
||||||
|
(enum)
|
||||||
|
(interface)
|
||||||
|
(implicit_generics)
|
||||||
|
(generics)
|
||||||
|
(group)
|
||||||
|
(method_parameters)
|
||||||
|
(named_return_types)
|
||||||
|
(struct)
|
||||||
|
(struct_shorthand)
|
||||||
|
(union)
|
||||||
|
] @fold
|
141
runtime/queries/capnp/highlights.scm
Normal file
141
runtime/queries/capnp/highlights.scm
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
; Preproc
|
||||||
|
|
||||||
|
(unique_id) @keyword.directive
|
||||||
|
(top_level_annotation_body) @keyword.directive
|
||||||
|
|
||||||
|
; Includes
|
||||||
|
|
||||||
|
[
|
||||||
|
"import"
|
||||||
|
"$import"
|
||||||
|
"embed"
|
||||||
|
] @keyword.control.import
|
||||||
|
|
||||||
|
(import_path) @string
|
||||||
|
|
||||||
|
; Builtins
|
||||||
|
|
||||||
|
[
|
||||||
|
(primitive_type)
|
||||||
|
"List"
|
||||||
|
] @type.builtin
|
||||||
|
|
||||||
|
; Typedefs
|
||||||
|
|
||||||
|
(type_definition) @type
|
||||||
|
|
||||||
|
; Labels (@number, @number!)
|
||||||
|
|
||||||
|
(field_version) @label
|
||||||
|
|
||||||
|
; Methods
|
||||||
|
|
||||||
|
(annotation_definition_identifier) @function.method
|
||||||
|
(method_identifier) @function.method
|
||||||
|
|
||||||
|
; Fields
|
||||||
|
|
||||||
|
(field_identifier) @variable.other.member
|
||||||
|
|
||||||
|
; Properties
|
||||||
|
|
||||||
|
(property) @label
|
||||||
|
|
||||||
|
; Parameters
|
||||||
|
|
||||||
|
(param_identifier) @variable.parameter
|
||||||
|
(return_identifier) @variable.parameter
|
||||||
|
|
||||||
|
; Constants
|
||||||
|
|
||||||
|
(const_identifier) @variable
|
||||||
|
(local_const) @constant
|
||||||
|
(enum_member) @type.enum.variant
|
||||||
|
|
||||||
|
(void) @constant.builtin
|
||||||
|
|
||||||
|
; Types
|
||||||
|
|
||||||
|
(enum_identifier) @type.enum
|
||||||
|
(extend_type) @type
|
||||||
|
(type_identifier) @type
|
||||||
|
|
||||||
|
; Attributes
|
||||||
|
|
||||||
|
(annotation_identifier) @attribute
|
||||||
|
(attribute) @attribute
|
||||||
|
|
||||||
|
; Operators
|
||||||
|
|
||||||
|
[
|
||||||
|
; @ ! -
|
||||||
|
"="
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
; Keywords
|
||||||
|
|
||||||
|
|
||||||
|
[
|
||||||
|
"annotation"
|
||||||
|
"enum"
|
||||||
|
"group"
|
||||||
|
"interface"
|
||||||
|
"struct"
|
||||||
|
"union"
|
||||||
|
] @keyword.storage.type
|
||||||
|
|
||||||
|
[
|
||||||
|
"extends"
|
||||||
|
"namespace"
|
||||||
|
"using"
|
||||||
|
(annotation_target)
|
||||||
|
] @special
|
||||||
|
|
||||||
|
; Literals
|
||||||
|
|
||||||
|
[
|
||||||
|
(string)
|
||||||
|
(concatenated_string)
|
||||||
|
(block_text)
|
||||||
|
(namespace)
|
||||||
|
] @string
|
||||||
|
|
||||||
|
(escape_sequence) @constant.character.escape
|
||||||
|
|
||||||
|
(data_string) @string.special
|
||||||
|
|
||||||
|
(number) @constant.numeric.integer
|
||||||
|
|
||||||
|
(float) @constant.numeric.float
|
||||||
|
|
||||||
|
(boolean) @constant.builtin.boolean
|
||||||
|
|
||||||
|
; Misc
|
||||||
|
|
||||||
|
[
|
||||||
|
"const"
|
||||||
|
] @keyword.storage.modifier
|
||||||
|
|
||||||
|
[
|
||||||
|
"*"
|
||||||
|
"$"
|
||||||
|
":"
|
||||||
|
] @string.special.symbol
|
||||||
|
|
||||||
|
["{" "}"] @punctuation.bracket
|
||||||
|
|
||||||
|
["(" ")"] @punctuation.bracket
|
||||||
|
|
||||||
|
["[" "]"] @punctuation.bracket
|
||||||
|
|
||||||
|
[
|
||||||
|
","
|
||||||
|
";"
|
||||||
|
"->"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
(data_hex) @constant
|
||||||
|
|
||||||
|
; Comments
|
||||||
|
|
||||||
|
(comment) @comment.line
|
19
runtime/queries/capnp/indents.scm
Normal file
19
runtime/queries/capnp/indents.scm
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
[
|
||||||
|
(annotation_targets)
|
||||||
|
(const_list)
|
||||||
|
(enum)
|
||||||
|
(interface)
|
||||||
|
(implicit_generics)
|
||||||
|
(generics)
|
||||||
|
(group)
|
||||||
|
(method_parameters)
|
||||||
|
(named_return_types)
|
||||||
|
(struct)
|
||||||
|
(struct_shorthand)
|
||||||
|
(union)
|
||||||
|
] @indent
|
||||||
|
|
||||||
|
[
|
||||||
|
"}"
|
||||||
|
")"
|
||||||
|
] @outdent
|
2
runtime/queries/capnp/injections.scm
Normal file
2
runtime/queries/capnp/injections.scm
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
((comment) @injection.content
|
||||||
|
(#set! injection.language "comment"))
|
96
runtime/queries/capnp/locals.scm
Normal file
96
runtime/queries/capnp/locals.scm
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
; Scopes
|
||||||
|
|
||||||
|
[
|
||||||
|
(message)
|
||||||
|
(annotation_targets)
|
||||||
|
(const_list)
|
||||||
|
(enum)
|
||||||
|
(interface)
|
||||||
|
(implicit_generics)
|
||||||
|
(generics)
|
||||||
|
(group)
|
||||||
|
(method_parameters)
|
||||||
|
(named_return_types)
|
||||||
|
(struct)
|
||||||
|
(struct_shorthand)
|
||||||
|
(union)
|
||||||
|
] @local.scope
|
||||||
|
|
||||||
|
; References
|
||||||
|
|
||||||
|
[
|
||||||
|
(extend_type)
|
||||||
|
(field_type)
|
||||||
|
] @local.reference
|
||||||
|
(custom_type (type_identifier) @local.reference)
|
||||||
|
(custom_type
|
||||||
|
(generics
|
||||||
|
(generic_parameters
|
||||||
|
(generic_identifier) @local.reference)))
|
||||||
|
|
||||||
|
; Definitions
|
||||||
|
|
||||||
|
(annotation_definition_identifier) @local.definition
|
||||||
|
|
||||||
|
(const_identifier) @local.definition
|
||||||
|
|
||||||
|
(enum (enum_identifier) @local.definition)
|
||||||
|
|
||||||
|
[
|
||||||
|
(enum_member)
|
||||||
|
(field_identifier)
|
||||||
|
] @local.definition
|
||||||
|
|
||||||
|
(method_identifier) @local.definition
|
||||||
|
|
||||||
|
(namespace) @local.definition
|
||||||
|
|
||||||
|
[
|
||||||
|
(param_identifier)
|
||||||
|
(return_identifier)
|
||||||
|
] @local.definition
|
||||||
|
|
||||||
|
(group (type_identifier) @local.definition)
|
||||||
|
|
||||||
|
(struct (type_identifier) @local.definition)
|
||||||
|
|
||||||
|
(union (type_identifier) @local.definition)
|
||||||
|
|
||||||
|
(interface (type_identifier) @local.definition)
|
||||||
|
|
||||||
|
; Generics Related (don't know how to combine these)
|
||||||
|
|
||||||
|
(struct
|
||||||
|
(generics
|
||||||
|
(generic_parameters
|
||||||
|
(generic_identifier) @local.definition)))
|
||||||
|
|
||||||
|
(interface
|
||||||
|
(generics
|
||||||
|
(generic_parameters
|
||||||
|
(generic_identifier) @local.definition)))
|
||||||
|
|
||||||
|
(method
|
||||||
|
(implicit_generics
|
||||||
|
(implicit_generic_parameters
|
||||||
|
(generic_identifier) @local.definition)))
|
||||||
|
|
||||||
|
(method
|
||||||
|
(generics
|
||||||
|
(generic_parameters
|
||||||
|
(generic_identifier) @local.definition)))
|
||||||
|
|
||||||
|
(annotation
|
||||||
|
(generics
|
||||||
|
(generic_parameters
|
||||||
|
(generic_identifier) @local.definition)))
|
||||||
|
|
||||||
|
(replace_using
|
||||||
|
(generics
|
||||||
|
(generic_parameters
|
||||||
|
(generic_identifier) @local.definition)))
|
||||||
|
|
||||||
|
(return_type
|
||||||
|
(generics
|
||||||
|
(generic_parameters
|
||||||
|
(generic_identifier) @local.definition)))
|
Loading…
Reference in New Issue
Block a user