mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-25 02:46:17 +04:00
Improve llvm highlighting and queries (#1388)
* Improve llvm highlighting and queries The llvm tree-sitter parser was updated to support scopes and more accurate highlighting. * Group highlight expressions better
This commit is contained in:
parent
f1ed042c84
commit
8c29b76bcc
@ -21,7 +21,7 @@
|
||||
| julia | ✓ | | | `julia` |
|
||||
| latex | ✓ | | | |
|
||||
| ledger | ✓ | | | |
|
||||
| llvm | ✓ | | | |
|
||||
| llvm | ✓ | ✓ | ✓ | |
|
||||
| lua | ✓ | | ✓ | |
|
||||
| markdown | ✓ | | | |
|
||||
| mint | | | | `mint` |
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit d4f61bed8ecb632addcd5e088c4f4cb9c1bf1c5b
|
||||
Subproject commit 3b213925b9c4f42c1acfe2e10bfbb438d9c6834d
|
@ -1,14 +1,158 @@
|
||||
(type) @type
|
||||
(statement) @keyword.operator
|
||||
(type_keyword) @type.builtin
|
||||
|
||||
(type [
|
||||
(local_var)
|
||||
(global_var)
|
||||
] @type)
|
||||
|
||||
(argument) @variable.parameter
|
||||
|
||||
(_ inst_name: _ @keyword.operator)
|
||||
|
||||
[
|
||||
"catch"
|
||||
"filter"
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"to"
|
||||
"nuw"
|
||||
"nsw"
|
||||
"exact"
|
||||
"unwind"
|
||||
"from"
|
||||
"cleanup"
|
||||
"swifterror"
|
||||
"volatile"
|
||||
"inbounds"
|
||||
"inrange"
|
||||
(icmp_cond)
|
||||
(fcmp_cond)
|
||||
(fast_math)
|
||||
] @keyword.control
|
||||
|
||||
(_ callee: _ @function)
|
||||
(function_header name: _ @function)
|
||||
|
||||
[
|
||||
"declare"
|
||||
"define"
|
||||
(calling_conv)
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
"target"
|
||||
"triple"
|
||||
"datalayout"
|
||||
"source_filename"
|
||||
"addrspace"
|
||||
"blockaddress"
|
||||
"align"
|
||||
"syncscope"
|
||||
"within"
|
||||
"uselistorder"
|
||||
"uselistorder_bb"
|
||||
"module"
|
||||
"asm"
|
||||
"sideeffect"
|
||||
"alignstack"
|
||||
"inteldialect"
|
||||
"unwind"
|
||||
"type"
|
||||
"global"
|
||||
"constant"
|
||||
"externally_initialized"
|
||||
"alias"
|
||||
"ifunc"
|
||||
"section"
|
||||
"comdat"
|
||||
"thread_local"
|
||||
"localdynamic"
|
||||
"initialexec"
|
||||
"localexec"
|
||||
"any"
|
||||
"exactmatch"
|
||||
"largest"
|
||||
"nodeduplicate"
|
||||
"samesize"
|
||||
"distinct"
|
||||
"attributes"
|
||||
"vscale"
|
||||
"no_cfi"
|
||||
(linkage_aux)
|
||||
(dso_local)
|
||||
(visibility)
|
||||
(dll_storage_class)
|
||||
(unnamed_addr)
|
||||
(attribute_name)
|
||||
] @keyword
|
||||
|
||||
|
||||
(function_header [
|
||||
(linkage)
|
||||
(calling_conv)
|
||||
(unnamed_addr)
|
||||
] @keyword.function)
|
||||
|
||||
[
|
||||
(string)
|
||||
(cstring)
|
||||
] @string
|
||||
|
||||
(number) @constant.numeric.integer
|
||||
(comment) @comment
|
||||
(string) @string
|
||||
(label) @label
|
||||
(keyword) @keyword
|
||||
"ret" @keyword.control.return
|
||||
(boolean) @constant.builtin.boolean
|
||||
(_ inst_name: "ret" @keyword.control.return)
|
||||
(float) @constant.numeric.float
|
||||
(constant) @constant
|
||||
(identifier) @variable
|
||||
(symbol) @punctuation.delimiter
|
||||
(bracket) @punctuation.bracket
|
||||
|
||||
[
|
||||
(local_var)
|
||||
(global_var)
|
||||
] @variable
|
||||
|
||||
[
|
||||
(struct_value)
|
||||
(array_value)
|
||||
(vector_value)
|
||||
] @constructor
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"<"
|
||||
">"
|
||||
"<{"
|
||||
"}>"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
","
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"="
|
||||
"|"
|
||||
"x"
|
||||
"..."
|
||||
] @operator
|
||||
|
||||
[
|
||||
"true"
|
||||
"false"
|
||||
] @constant.builtin.boolean
|
||||
|
||||
[
|
||||
"undef"
|
||||
"poison"
|
||||
"null"
|
||||
"none"
|
||||
"zeroinitializer"
|
||||
] @constant.builtin
|
||||
|
||||
(ERROR) @error
|
||||
|
8
runtime/queries/llvm/indents.toml
Normal file
8
runtime/queries/llvm/indents.toml
Normal file
@ -0,0 +1,8 @@
|
||||
indent = [
|
||||
"function_body",
|
||||
"instruction",
|
||||
]
|
||||
|
||||
outdent = [
|
||||
"}",
|
||||
]
|
14
runtime/queries/llvm/locals.scm
Normal file
14
runtime/queries/llvm/locals.scm
Normal file
@ -0,0 +1,14 @@
|
||||
; Scopes
|
||||
|
||||
(function_body) @local.scope
|
||||
|
||||
; Definitions
|
||||
|
||||
(argument
|
||||
(value (var (local_var) @local.definition)))
|
||||
|
||||
(instruction
|
||||
(local_var) @local.definition)
|
||||
|
||||
; References
|
||||
(local_var) @local.reference
|
16
runtime/queries/llvm/textobjects.scm
Normal file
16
runtime/queries/llvm/textobjects.scm
Normal file
@ -0,0 +1,16 @@
|
||||
(define
|
||||
body: (_) @function.inside) @function.around
|
||||
|
||||
(struct_type
|
||||
(struct_body) @class.inside) @class.around
|
||||
|
||||
(packed_struct_type
|
||||
(struct_body) @class.inside) @class.around
|
||||
|
||||
(array_type
|
||||
(array_vector_body) @class.inside) @class.around
|
||||
|
||||
(vector_type
|
||||
(array_vector_body) @class.inside) @class.around
|
||||
|
||||
(argument) @parameter.inside
|
Loading…
Reference in New Issue
Block a user