domluna / JuliaFormatter.jl

An opinionated code formatter for Julia. Plot twist - the opinion is your own.

Home Page:https://domluna.github.io/JuliaFormatter.jl/dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

format "+a+1" throws an error

irsn23 opened this issue · comments

commented

+a+1 is a valid julia expression, like the example below

julia> a=1
1

julia> +a+1
2

but if i run JuliaFormatter.format("+a+1"), this throws an error

julia> JuliaFormatter.format_text("+a+1")
ERROR: Error while PARSING formatted text:

1 a + 1 +

...

Error occurred on line 1, offset 5 of formatted text.

The error might not be precisely on this line but it should be in the region of the code block. Try commenting the region out and see if that removes the error.

as you can see, JuliaFormatter seems to move the first + symbol at the last of the expression and thus causes error. On the other hand, JuliaFormatter.format_text("+a") seems alright.

my JuliaFormatter version is as below

[98e50ef6] JuliaFormatter v1.0.37