JuliaFormatter.jl icon indicating copy to clipboard operation
JuliaFormatter.jl copied to clipboard

Put quotes around nothing

Open araujoms opened this issue 1 year ago • 9 comments

The documentation says that we need always_for_in = nothing to disable it, but this is not true, what we need is always_for_in = "nothing". I've changed the documentation to match the code, and also the style file pretty.jl which was broken.

araujoms avatar Apr 30 '24 10:04 araujoms

in what situation does this come up? Config from a .JuliaFormatter.toml file?

domluna avatar Apr 30 '24 15:04 domluna

Indeed, put that into .JuliaFormatter.toml, call format, and see it fail.

araujoms avatar Apr 30 '24 15:04 araujoms

ahh ic. In that case I'm rather see if we can get this worse as is with some additional parsing handling of the TOML file

domluna avatar Apr 30 '24 16:04 domluna

My syntax highlighting really doesn't like "nothing" without the quotation marks in a TOML file, so maybe this violates the format specification?

araujoms avatar Apr 30 '24 16:04 araujoms

Yeah, that's invalid TOML. Should really be a string imho.

pfitzseb avatar Apr 30 '24 17:04 pfitzseb

https://github.com/domluna/JuliaFormatter.jl/blob/master/src/JuliaFormatter.jl#L487-L493

ok so this would already work if the value is "nothing" so we don't need to update anything besides documentation can we change the PR to do that instead.

domluna avatar Apr 30 '24 18:04 domluna

That's what the PR is doing.

araujoms avatar Apr 30 '24 18:04 araujoms

That's what the PR is doing.

it's changing it to "nothing" but during parsing when "nothing" is written in the TOML file it will be converted to nothing, so we don't need to change the code implementation. What I was referring to would be a note that says the TOML file should be

always_for_in = "nothing"

and not

always_for_in = nothing

domluna avatar May 01 '24 16:05 domluna

I know, I'm not changing the code implementation, I'm only changing the documentation (and the style file pretty.jl).

araujoms avatar May 01 '24 16:05 araujoms

Nevermind then.

araujoms avatar May 14 '24 09:05 araujoms