Merge pull request #1559 from zed-industries/language-injection
Add language injection support
This commit is contained in:
commit
d4bbf21650
16 changed files with 2513 additions and 412 deletions
7
crates/zed/src/languages/c/injections.scm
Normal file
7
crates/zed/src/languages/c/injections.scm
Normal file
|
@ -0,0 +1,7 @@
|
|||
(preproc_def
|
||||
value: (preproc_arg) @content
|
||||
(#set! "language" "c"))
|
||||
|
||||
(preproc_function_def
|
||||
value: (preproc_arg) @content
|
||||
(#set! "language" "c"))
|
|
@ -1,3 +1,5 @@
|
|||
(identifier) @variable
|
||||
|
||||
(call_expression
|
||||
function: (qualified_identifier
|
||||
name: (identifier) @function))
|
||||
|
@ -34,8 +36,6 @@
|
|||
(auto) @type
|
||||
(type_identifier) @type
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
|
|
7
crates/zed/src/languages/cpp/injections.scm
Normal file
7
crates/zed/src/languages/cpp/injections.scm
Normal file
|
@ -0,0 +1,7 @@
|
|||
(preproc_def
|
||||
value: (preproc_arg) @content
|
||||
(#set! "language" "c++"))
|
||||
|
||||
(preproc_function_def
|
||||
value: (preproc_arg) @content
|
||||
(#set! "language" "c++"))
|
|
@ -1,6 +1,6 @@
|
|||
(type_identifier) @type
|
||||
(primitive_type) @type.builtin
|
||||
|
||||
(self) @variable.builtin
|
||||
(field_identifier) @property
|
||||
|
||||
(call_expression
|
||||
|
@ -15,6 +15,16 @@
|
|||
(function_item name: (identifier) @function.definition)
|
||||
(function_signature_item name: (identifier) @function.definition)
|
||||
|
||||
(macro_invocation
|
||||
macro: [
|
||||
(identifier) @function.special
|
||||
(scoped_identifier
|
||||
name: (identifier) @function.special)
|
||||
])
|
||||
|
||||
(macro_definition
|
||||
name: (identifier) @function.special.definition)
|
||||
|
||||
; Identifier conventions
|
||||
|
||||
; Assume uppercase names are enum constructors
|
||||
|
@ -71,6 +81,7 @@
|
|||
"mod"
|
||||
"move"
|
||||
"pub"
|
||||
"ref"
|
||||
"return"
|
||||
"static"
|
||||
"struct"
|
||||
|
@ -91,6 +102,13 @@
|
|||
(char_literal)
|
||||
] @string
|
||||
|
||||
[
|
||||
(integer_literal)
|
||||
(float_literal)
|
||||
] @number
|
||||
|
||||
(boolean_literal) @constant
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
|
|
7
crates/zed/src/languages/rust/injections.scm
Normal file
7
crates/zed/src/languages/rust/injections.scm
Normal file
|
@ -0,0 +1,7 @@
|
|||
(macro_invocation
|
||||
(token_tree) @content
|
||||
(#set! "language" "rust"))
|
||||
|
||||
(macro_rule
|
||||
(token_tree) @content
|
||||
(#set! "language" "rust"))
|
Loading…
Add table
Add a link
Reference in a new issue