-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support for Julia language #2
Comments
I'm open to having Julia support added, but since it's not a language I've ever used I wouldn't implement it myself and instead would be willing to help guide someone with Julia experience to implement it. I'll give some details below on how to add support. Adding support is as simple as added a single tree-sitter query file, see https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries for query syntax. Make a file In Lua, we have the following queries, https://github.com/RRethy/nvim-treesitter-endwise/blob/master/queries/lua/endwise.scm. Let's focus on the function definition queries, of which there are two: ((ERROR ("function" . (_)? . (parameters) @cursor) @indent) (#endwise! "end")) The first query with function foo()<cursor> Since we are working with syntax trees that have an error in them, we will expect the parser to be in a weird state and not be able to parse this code into a Let's now take a look at the second query: ((function_definition parameters: (_) @cursor) @endable @indent (#endwise! "end")) This one is a bit more complicated but it's a side effect of tree-sitter generating parsers which follow maximal-munch. Let's take a look at a piece of code: function foo()
function bar()<cursor>
end If we look at this, we know that the To help you with writing queries, try writing some Julia code which you would expect to have an |
Thank you much for the detailed guidelines. I am myself still learning the language, so it will be a good challenge. I am however quite occupied these days, so i will not be able to give it a grasp in the coming days, but as soon as I do, I will start working on it. As you say, I think it will be straightforward since the syntax is so similar to I will try to make a PR when it is ready 😄. |
I think @jasonrhansen has started work on adding Julia support FWIW (https://github.com/jasonrhansen/nvim-treesitter-endwise/tree/julia). |
Oh, I just saw that! Well awesome then. |
Can you review the Julia PR linked to go through the use-cases. |
I will be able to check it after next week (exams). Sorry for the delay! |
Have you had a chance to take a look through the PR? |
Yes, it seems OK! The only thing I don't understand is why, when I'm here for i in 1:5
|
end and press |
Can you comment that on the PR as part of a PR review. |
Bumping this, can you provide a PR review on that PR raising the issues you found. |
Hi,
This seems a great plugin. Could it be implemented for Julia as well? The syntax is very similar to the Ruby one.
Thank you!
The text was updated successfully, but these errors were encountered: