Merge pull request #1559 from zed-industries/language-injection

Add language injection support
This commit is contained in:
Max Brunsfeld 2022-08-30 11:54:00 -07:00 committed by GitHub
commit d4bbf21650
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 2513 additions and 412 deletions

View file

@ -0,0 +1,7 @@
(preproc_def
value: (preproc_arg) @content
(#set! "language" "c"))
(preproc_function_def
value: (preproc_arg) @content
(#set! "language" "c"))

View file

@ -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_]*$"))

View file

@ -0,0 +1,7 @@
(preproc_def
value: (preproc_arg) @content
(#set! "language" "c++"))
(preproc_function_def
value: (preproc_arg) @content
(#set! "language" "c++"))

View file

@ -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)

View file

@ -0,0 +1,7 @@
(macro_invocation
(token_tree) @content
(#set! "language" "rust"))
(macro_rule
(token_tree) @content
(#set! "language" "rust"))