-
Notifications
You must be signed in to change notification settings - Fork 71
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
Begin to attempt to add trailing zeros to Float literals #66
Conversation
@odow This looks like it's on the right track. https://github.com/julia-vscode/CSTParser.jl/blob/master/src/spec.jl is the best reference for node types. The only new types introduced in the formatter are You shouldn't be editing the CST from This should work: val = x.val
if x.kind === Tokens.FLOAT && val[end] == '.'
val *= '0'
end
return PTree(x, loc[1], loc[1], val) Token types are found in https://github.com/JuliaLang/Tokenize.jl/blob/master/src/token_kinds.jl |
BTW Does the trailing zero come up at all with complex numbers or would this already handle that? |
LGTM. Let me know if it's ready to merge in or if you're still making changes. |
Thanks for you help. I was missing the fact that the I believe What's the policy on running |
No problem. I need to add more documentation to this thing so it's kind of my fault 🙃 . Generally I do |
I guess one hack would be to add format(joinpath(dirname(@__DIR__, "src")))
format(@__FILE__) to the bottom of |
that or GH support can get back to me so I can get this to work https://github.com/domluna/JuliaFormatter-action 😄 Anyway I'm gonna merge this in, thanks again! |
So I wanted to implement adding trailing zeros to Float literals (#61), but I quickly got stuck.
I haven't quite got my head around
PTree
s, so I'm stumbling around in the dark.Is this the correct way to implement this? Or do I need to add a node to the tree like you did here:
8944eaa#diff-9915f66306b42c958fcd076dc0eee523R1228
At the moment I get