Skip to content

Commit

Permalink
feat: Julia support
Browse files Browse the repository at this point in the history
  • Loading branch information
frankebel authored and lewis6991 committed Sep 27, 2023
1 parent 6795de0 commit 44d270e
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Note: if you need support for Neovim 0.6.x please use the tag `compat/0.6`.
- [x] `java`
- [x] `javascript`
- [x] `json`
- [x] `julia`
- [x] `latex`
- [x] `lua`
- [x] `markdown`
Expand Down Expand Up @@ -122,7 +123,6 @@ Note: if you need support for Neovim 0.6.x please use the tag `compat/0.6`.
- [ ] `jsonc`
- [ ] `jsonnet`
- [ ] `jsx`
- [ ] `julia`
- [ ] `kdl`
- [ ] `kotlin`
- [ ] `lalrpop`
Expand Down
17 changes: 17 additions & 0 deletions queries/julia/context.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(struct_definition) @context

(function_definition
parameters: (_) @context.final
) @context

(for_statement) @context

(if_statement
condition: (_) @context.final
) @context

(while_statement
condition: (_) @context.final
) @context

(try_statement) @context
88 changes: 88 additions & 0 deletions test/test.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
struct Foo{T}
bar::T # T can be any type
baz::Int
# comment
# comment
# comment
# comment
# comment
# comment
# comment
# comment
# comment
# comment
end

function myfunc(
x::Vector,
y::Int,
)
@assert y > 0
for i in 1:y
if i == 0 &&
i == 0 # Unnecessary condition to go over 2 lines.
println("zero")
# comment
# comment
# comment
# comment
# comment
elseif i == 1
println("one")
# comment
# comment
# comment
# comment
# comment
else
println("other")
# comment
# comment
# comment
# comment
# comment
end
end
# comment
# comment
# comment
# comment
# comment
foo = y
while foo > 0 &&
foo > 0 # Unnecessary condition to go over 2 lines.
println(foo)
foo -= 1
# comment
# comment
# comment
# comment
# comment
end
# comment
# comment
# comment
# comment
# comment
try
sqrt("ten")
# comment
# comment
# comment
# comment
# comment
catch e
println(e)
# comment
# comment
# comment
# comment
# comment
end
# comment
# comment
# comment
# comment
# comment
return y * x
end

0 comments on commit 44d270e

Please sign in to comment.