-
Notifications
You must be signed in to change notification settings - Fork 69
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
Error formatting code containing multiline comment #822
Comments
I guess this is not a CSTParser issue. (@v1.10) pkg> why CSTParser
JuliaFormatter → CSTParser
(@v1.10) pkg> status -m CSTParser
Status `~\.julia\environments\v1.10\Manifest.toml`
[00ebfdb7] CSTParser v3.4.2
julia> using JuliaFormatter: CSTParser
julia> str = "π => #= comment\ncomment =#\nim";
julia> CSTParser.parse(str)
1:30 call
1:25 OP: =>
26:28 π
29:30 im |
multi line comments are hard to deal with atm, for the time being id
recommend using other comments for something like this
…On Fri, Mar 8, 2024 at 9:03 PM Heptazhou ***@***.***> wrote:
julia> using JuliaFormatter
julia> str = "π => #= comment\ncomment =#\nim"; println(str)
π => #= commentcomment =#
im
julia> Meta.parse(str) |> eval
π => im
julia> format_text(str)
ERROR: Error while PARSING formatted text:
1 π => = comment2 comment =#
...
Error occurred on line 2, offset 9 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.
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:35
[2] format_text(cst::CSTParser.EXPR, style::DefaultStyle, s::JuliaFormatter.State)
@ JuliaFormatter ~\.julia\packages\JuliaFormatter\rcw7l\src\JuliaFormatter.jl:314
[3] format_text(text::String, style::DefaultStyle, opts::JuliaFormatter.Options)
@ JuliaFormatter ~\.julia\packages\JuliaFormatter\rcw7l\src\JuliaFormatter.jl:243
[4] #format_text#276
@ ~\.julia\packages\JuliaFormatter\rcw7l\src\JuliaFormatter.jl:215 [inlined]
[5] format_text
@ ~\.julia\packages\JuliaFormatter\rcw7l\src\JuliaFormatter.jl:212 [inlined]
[6] #format_text#275
@ ~\.julia\packages\JuliaFormatter\rcw7l\src\JuliaFormatter.jl:209 [inlined]
[7] format_text(text::String)
@ JuliaFormatter ~\.julia\packages\JuliaFormatter\rcw7l\src\JuliaFormatter.jl:208
[8] top-level scope
@ REPL[4]:1
***@***.***) pkg> status JuliaFormatter
Status `~\.julia\environments\v1.10\Project.toml`
[98e50ef6] JuliaFormatter v1.0.52
—
Reply to this email directly, view it on GitHub
<#822>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAORUFYZK24VRECSK76E6G3YXJUWBAVCNFSM6AAAAABENWXHUGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE3TOMBQGUYDENQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
CSTParser ignores comments entirely
…On Fri, Mar 8, 2024 at 9:25 PM Heptazhou ***@***.***> wrote:
I guess this is not a CSTParser issue.
***@***.***) pkg> why CSTParser
JuliaFormatter → CSTParser
***@***.***) pkg> status -m CSTParser
Status `~\.julia\environments\v1.10\Manifest.toml`
[00ebfdb7] CSTParser v3.4.2
julia> using JuliaFormatter: CSTParser
julia> str = "π => #= comment\ncomment =#\nim";
julia> CSTParser.parse(str)
1:30 call
1:25 OP: =>
26:28 π
29:30 im
—
Reply to this email directly, view it on GitHub
<#822 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAORUF77CJWAY6DOXBH2VHLYXJXKJAVCNFSM6AAAAABENWXHUGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBWGY4TONRUGA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Oops, I forgot that. |
I should rewrite to JuliaSyntax one of these days. I think that would make stuff like this easier. |
Heptazhou
added a commit
to Heptazhou/JLfmt.jl
that referenced
this issue
Mar 9, 2024
Heptazhou
added a commit
to Heptazhou/JLfmt.jl
that referenced
this issue
Mar 9, 2024
Heptazhou
added a commit
to Heptazhou/JLfmt.jl
that referenced
this issue
Mar 9, 2024
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: