Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Julia support #335

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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