aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergio A. Vargas <savargasqu+git@unal.edu.co>2024-04-14 07:23:46 -0500
committerGitHub <noreply@github.com>2024-04-14 14:23:46 +0200
commitd2f4c7830377d6d036e9621ae696dbd28f089897 (patch)
tree67bd1e74de0f9cfef12a968a366ca7122e6971f2
parentci: replace node with upstream action (diff)
downloadnvim-treesitter-d2f4c7830377d6d036e9621ae696dbd28f089897.tar
nvim-treesitter-d2f4c7830377d6d036e9621ae696dbd28f089897.tar.gz
nvim-treesitter-d2f4c7830377d6d036e9621ae696dbd28f089897.tar.bz2
nvim-treesitter-d2f4c7830377d6d036e9621ae696dbd28f089897.tar.lz
nvim-treesitter-d2f4c7830377d6d036e9621ae696dbd28f089897.tar.xz
nvim-treesitter-d2f4c7830377d6d036e9621ae696dbd28f089897.tar.zst
nvim-treesitter-d2f4c7830377d6d036e9621ae696dbd28f089897.zip
fix(julia): adapt queries to grammar changes (#6429)
-rw-r--r--lockfile.json2
-rw-r--r--queries/julia/highlights.scm62
-rw-r--r--queries/julia/indents.scm4
-rw-r--r--queries/julia/injections.scm1
-rw-r--r--queries/julia/locals.scm33
-rw-r--r--tests/query/highlights/julia/test.jl2
6 files changed, 23 insertions, 81 deletions
diff --git a/lockfile.json b/lockfile.json
index a9e063751..196b2582c 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -348,7 +348,7 @@
"revision": "d34615fa12cc1d1cfc1f1f1a80acc9db80ee4596"
},
"julia": {
- "revision": "e84f10db8eeb8b9807786bfc658808edaa1b4fa2"
+ "revision": "c0acda09c0c70d4515402f9ebb1ad369fa0afabf"
},
"just": {
"revision": "6c2f018ab1d90946c0ce029bb2f7d57f56895dff"
diff --git a/queries/julia/highlights.scm b/queries/julia/highlights.scm
index f48d97d97..99aa9d1b3 100644
--- a/queries/julia/highlights.scm
+++ b/queries/julia/highlights.scm
@@ -4,14 +4,6 @@
; ;; If you want type highlighting based on Julia naming conventions (this might collide with mathematical notation)
; ((identifier) @type
; (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
":" @string.special.symbol
[
@@ -22,22 +14,6 @@
(field_expression
(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
(call_expression
(identifier) @function.call)
@@ -59,6 +35,17 @@
(identifier) @function.call
(#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
((identifier) @function.builtin
(#any-of? @function.builtin
@@ -69,25 +56,6 @@
"modifyfield!" "nfields" "replacefield!" "set_binding_type!" "setfield!" "sizeof" "svec"
"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
; Definitions
(abstract_definition
@@ -118,11 +86,8 @@
(typed_expression
(identifier) @type .)
-(function_definition
- return_type: (identifier) @type)
-
-(short_function_definition
- return_type: (identifier) @type)
+(unary_typed_expression
+ (identifier) @type .)
(where_clause
(identifier) @type)
@@ -387,7 +352,6 @@
(abstract_definition)
(struct_definition)
(function_definition)
- (short_function_definition)
(assignment)
(const_statement)
])
diff --git a/queries/julia/indents.scm b/queries/julia/indents.scm
index bf4932ec3..7b40f876e 100644
--- a/queries/julia/indents.scm
+++ b/queries/julia/indents.scm
@@ -47,10 +47,6 @@
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")"))
-((parameter_list) @indent.align
- (#set! indent.open_delimiter "(")
- (#set! indent.close_delimiter ")"))
-
((curly_expression) @indent.align
(#set! indent.open_delimiter "{")
(#set! indent.close_delimiter "}"))
diff --git a/queries/julia/injections.scm b/queries/julia/injections.scm
index 07af15a11..d8bae2e99 100644
--- a/queries/julia/injections.scm
+++ b/queries/julia/injections.scm
@@ -6,7 +6,6 @@
(abstract_definition)
(struct_definition)
(function_definition)
- (short_function_definition)
(assignment)
(const_statement)
]
diff --git a/queries/julia/locals.scm b/queries/julia/locals.scm
index 3e7654b06..767239f15 100644
--- a/queries/julia/locals.scm
+++ b/queries/julia/locals.scm
@@ -39,35 +39,18 @@
(import_statement
(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_definition
- name: (identifier) @local.definition.function) @local.scope
-
-(short_function_definition
- name: (identifier) @local.definition.function) @local.scope
+ (signature
+ (call_expression
+ .
+ (identifier) @local.definition.function))) @local.scope
(macro_definition
- name: (identifier) @local.definition.macro) @local.scope
+ (signature
+ (call_expression
+ .
+ (identifier) @local.definition.function))) @local.scope
(identifier) @local.reference
diff --git a/tests/query/highlights/julia/test.jl b/tests/query/highlights/julia/test.jl
index 065df5c9e..445efaa1f 100644
--- a/tests/query/highlights/julia/test.jl
+++ b/tests/query/highlights/julia/test.jl
@@ -1,6 +1,6 @@
function load_data(::Symbol; ::Int) :: Tuple
# <- @keyword.function
-# ^ @function
+# ^ @function.call
# ^ @punctuation.bracket
# ^^ @punctuation.delimiter
# ^ @type.builtin