fix(julia): adapt queries to grammar changes (#6429)

This commit is contained in:
Sergio A. Vargas 2024-04-14 07:23:46 -05:00 committed by GitHub
parent 86ac7e9274
commit d2f4c78303
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 23 additions and 81 deletions

View file

@ -348,7 +348,7 @@
"revision": "d34615fa12cc1d1cfc1f1f1a80acc9db80ee4596" "revision": "d34615fa12cc1d1cfc1f1f1a80acc9db80ee4596"
}, },
"julia": { "julia": {
"revision": "e84f10db8eeb8b9807786bfc658808edaa1b4fa2" "revision": "c0acda09c0c70d4515402f9ebb1ad369fa0afabf"
}, },
"just": { "just": {
"revision": "6c2f018ab1d90946c0ce029bb2f7d57f56895dff" "revision": "6c2f018ab1d90946c0ce029bb2f7d57f56895dff"

View file

@ -4,14 +4,6 @@
; ;; If you want type highlighting based on Julia naming conventions (this might collide with mathematical notation) ; ;; If you want type highlighting based on Julia naming conventions (this might collide with mathematical notation)
; ((identifier) @type ; ((identifier) @type
; (match? @type "^[A-Z][^_]")) ; exception: Highlight `A_foo` sort of identifiers as variables ; (match? @type "^[A-Z][^_]")) ; exception: Highlight `A_foo` sort of identifiers as variables
(macro_identifier) @function.macro
(macro_identifier
(identifier) @function.macro) ; for any one using the variable highlight
(macro_definition
name: (identifier) @function.macro)
(quote_expression (quote_expression
":" @string.special.symbol ":" @string.special.symbol
[ [
@ -22,22 +14,6 @@
(field_expression (field_expression
(identifier) @variable.member .) (identifier) @variable.member .)
; Function names
; Definitions
(function_definition
name: (identifier) @function)
(short_function_definition
name: (identifier) @function)
(function_definition
name: (field_expression
(identifier) @function .))
(short_function_definition
name: (field_expression
(identifier) @function .))
; calls ; calls
(call_expression (call_expression
(identifier) @function.call) (identifier) @function.call)
@ -59,6 +35,17 @@
(identifier) @function.call (identifier) @function.call
(#any-of? @_pipe "|>" ".|>")) (#any-of? @_pipe "|>" ".|>"))
(macro_identifier) @function.macro
(macro_identifier
(identifier) @function.macro) ; for any one using the variable highlight
(macro_definition
(signature
(call_expression
.
(identifier) @function.macro)))
; Builtins ; Builtins
((identifier) @function.builtin ((identifier) @function.builtin
(#any-of? @function.builtin (#any-of? @function.builtin
@ -69,25 +56,6 @@
"modifyfield!" "nfields" "replacefield!" "set_binding_type!" "setfield!" "sizeof" "svec" "modifyfield!" "nfields" "replacefield!" "set_binding_type!" "setfield!" "sizeof" "svec"
"swapfield!" "throw" "tuple" "typeassert" "typeof")) "swapfield!" "throw" "tuple" "typeassert" "typeof"))
; Parameters
(parameter_list
(identifier) @variable.parameter)
(optional_parameter
.
(identifier) @variable.parameter)
(slurp_parameter
(identifier) @variable.parameter)
(typed_parameter
parameter: (identifier)? @variable.parameter
type: (_) @type)
(function_expression
.
(identifier) @variable.parameter) ; Single parameter arrow functions
; Types ; Types
; Definitions ; Definitions
(abstract_definition (abstract_definition
@ -118,11 +86,8 @@
(typed_expression (typed_expression
(identifier) @type .) (identifier) @type .)
(function_definition (unary_typed_expression
return_type: (identifier) @type) (identifier) @type .)
(short_function_definition
return_type: (identifier) @type)
(where_clause (where_clause
(identifier) @type) (identifier) @type)
@ -387,7 +352,6 @@
(abstract_definition) (abstract_definition)
(struct_definition) (struct_definition)
(function_definition) (function_definition)
(short_function_definition)
(assignment) (assignment)
(const_statement) (const_statement)
]) ])

View file

@ -47,10 +47,6 @@
(#set! indent.open_delimiter "(") (#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")")) (#set! indent.close_delimiter ")"))
((parameter_list) @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")"))
((curly_expression) @indent.align ((curly_expression) @indent.align
(#set! indent.open_delimiter "{") (#set! indent.open_delimiter "{")
(#set! indent.close_delimiter "}")) (#set! indent.close_delimiter "}"))

View file

@ -6,7 +6,6 @@
(abstract_definition) (abstract_definition)
(struct_definition) (struct_definition)
(function_definition) (function_definition)
(short_function_definition)
(assignment) (assignment)
(const_statement) (const_statement)
] ]

View file

@ -39,35 +39,18 @@
(import_statement (import_statement
(identifier) @local.definition.import) (identifier) @local.definition.import)
; Parameters
(parameter_list
(identifier) @local.definition.parameter)
(optional_parameter
.
(identifier) @local.definition.parameter)
(slurp_parameter
(identifier) @local.definition.parameter)
(typed_parameter
parameter: (identifier) @local.definition.parameter
(_))
; Single parameter arrow function
(function_expression
.
(identifier) @local.definition.parameter)
; Function/macro definitions ; Function/macro definitions
(function_definition (function_definition
name: (identifier) @local.definition.function) @local.scope (signature
(call_expression
(short_function_definition .
name: (identifier) @local.definition.function) @local.scope (identifier) @local.definition.function))) @local.scope
(macro_definition (macro_definition
name: (identifier) @local.definition.macro) @local.scope (signature
(call_expression
.
(identifier) @local.definition.function))) @local.scope
(identifier) @local.reference (identifier) @local.reference

View file

@ -1,6 +1,6 @@
function load_data(::Symbol; ::Int) :: Tuple function load_data(::Symbol; ::Int) :: Tuple
# <- @keyword.function # <- @keyword.function
# ^ @function # ^ @function.call
# ^ @punctuation.bracket # ^ @punctuation.bracket
# ^^ @punctuation.delimiter # ^^ @punctuation.delimiter
# ^ @type.builtin # ^ @type.builtin