Formatter removing necessary semi-colon to concatenate arrays
mrazomej opened this issue · comments
As part of my code hygiene customs, I break lines every 79 characters. But the auto-formatting feature of the package doesn't allow me to do it in the following context (the code is irrelevant since what matters is what the autoformatting part does):
I want to concatenate two vectors in the following way:
vector_to_concatenate = [
repeat([foo], foo_times);
repeat([bar], bar_times)
]
But when I save the file, the autocorrect erases the semi-colon; needed for the concatenation. Obviously, in this example, I wouldn't need to break lines since I can write
vector_to_concatenate = [repeat([foo], foo_times); repeat([bar], bar_times)]
But if the variable names are longer, making this line > 79 characters, I would not want to have it as a single line. Is this something that can be easily fixed?
Thanks in advance for your help. I'm a big fan of what you guys are doing!
whats the .JuliaFormatter.toml file you're using?
I am going to sound like a total novice, which I am, but I don't know where that toml file would be located. I am simply using the VSCode extension. I posted this on their GitHub and they told me to post it over here. Where can I find this file to share it with you?
I think the vscode extension uses MinimalStyle so it would mimic formatting the directory with format(".", MinimalStyle())
you can create a .JuliaFormatter.toml in the root of your directory and then setup options from there.
the semicolon is removed in this case because it's equivalent
julia> vector_to_concatenate = [
repeat(["a"], 3);
repeat(["b"], 4)
]
7-element Vector{String}:
"a"
"a"
"a"
"b"
"b"
"b"
"b"
julia> vector_to_concatenate = [
repeat(["a"], 3)
repeat(["b"], 4)
]
7-element Vector{String}:
"a"
"a"
"a"
"b"
"b"
"b"
"b"