-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add Julia support #84
Conversation
lua/neogen/configurations/julia.lua
Outdated
{ | ||
retrieve = "all", | ||
node_type = "typed_parameter", | ||
subtree = { { retrieve = "all", node_type = "identifier", extract = true } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe try with
subtree = {
{
position = 1,
extract = true,
as = I.Identifier
},
{
position = 2,
extract = true,
as = ...
},
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this doesn't work, just retrieve the parent node aka typed_parameter
and do a Lua separation with ::
.
lua/neogen/configurations/julia.lua
Outdated
end, | ||
}) | ||
:add_default_annotation("google_docstrings") | ||
:add_annotation("numpydoc") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be sure to create your own Julia convention when it progresses
I think for now this is probably sufficient but I will need to add more as I understand how julia documentation works! |
Hello ! Very cool ! Can you share me some code examples of your features, and tell me which convention you used ? |
Hello @josephsdavid , what's the state of the integration ? |
Oh! I have forgotten to finish the job here, let me make these things! |
So as far as conventions, Julia does not have established conventions like numpydoc jsdoc emmylua etc, so I guess we could just call it something like "Julia Alternative" or "Julia unspecified", it is based off of how we document open source stuff at my job, example, so I guess we could call it "Beacon format" for lack of a better name! import Base: +, *, /
"""
Point
A type representing a point in 2d space
Where...
x::Number is the x coordinate
y::Number is the y coordinate
"""
struct Point
x::Number
y::Number
end
# Open question: Generate docs for this type of function
+(a::Point, b::Point) = Point(a.x + b.x, a.y + b.y)
+(a::Point, b::Number) = Point(a.x + b, a.y + b)
*(a::Point, b::Point) = Point(a.x * b.x, a.y * b.y)
/(a::Point, b::Number) = Point(a.x / b, a.y / b)
"""
f(x,y,z,w)
f does some operations on some points and numbers
Where...
z::Number is a shift factor, which shifts a point
w::Number is a scaling factor, which scales the output
x is the first point
y is the second point
"""
function f(x, y, z::Number = 1, w::Number = 3)
return (x * (y + z)) / w
end above is a little code demo, two sort of open questions are:
|
Actually Julia defines some conventions in the documentation or more accurately in Documenter.jl. Arguments are actually introduced with:
|
Ah let me change this! Should be resolved in latest commit |
the format is currently wrong ("- |
Here we go! Thank you by the way :) |
new code sample! import Base: +, *, /
"""
Point(x,y)
A struct representing a 2d point
# Arguments
- `x::Number` is the x coordinate
- `y::Number` is the y coordinate
"""
struct Point
x::Number
y::Number
end
# Open question: Generate docs for this type of function
+(a::Point, b::Point) = Point(a.x + b.x, a.y + b.y)
+(a::Point, b::Number) = Point(a.x + b, a.y + b)
*(a::Point, b::Point) = Point(a.x * b.x, a.y * b.y)
/(a::Point, b::Number) = Point(a.x / b, a.y / b)
"""
f(x,y,z,w)
f does some operations on some points and numbers
# Arguments
- `z::Number` is a shift factor, which shifts a point
- `w::Number` is a scaling factor, which scales the output
- `x` is the first point
- `y` is the second point
"""
function f(x, y, z::Number = 1, w::Number = 3)
return (x * (y + z)) / w
end
a = Point(1,2)
b = Point(1,3)
f(a,b) |
Thanks! I will knock this out after work :) |
So need to figure out how to get the arguments in order, it is tricky because I have to parse typed and nontyped arguments separately, and default arguments I need to figure out as well (and typed default arguments 🤯 !) So this will likely turn into a weekend project! |
I'm afraid that's a limitation at the moment.. |
if thats the limitation, it seems i just need to get the default arguments to show up and then it is good! |
Still stuck here lol but have not forgotten |
Hello, what's the current state of this PR ? What are the current things I can catch on and try to merge it ? |
Hello @josephsdavid, I can finish implementing this PR if you think it's in a good progress. If so, could you pinpoint me what needs to be continued ? EDIT: iirc, thats the only thing missing ?:
|
Hello @josephsdavid , #185 is being merged for julia support on neogen ! I will close this issue, now that the other one can be marked as the new reference. Thanks again for all your preliminary help. Best, |
Slowly figuring out how to add julia support, currently just for functions and structs as that is all i know how to do, but eventually maybe macro docs... todos: