In VSCode, when I use the formatter on something like this:
m = [ 1 0
0 1 ]
I get something like this:
m = [ 1 0
0 1 ]
Is there some option or simple way to disable that formatting of multi-line matrices?
In VSCode, when I use the formatter on something like this:
m = [ 1 0
0 1 ]
I get something like this:
m = [ 1 0
0 1 ]
Is there some option or simple way to disable that formatting of multi-line matrices?
In the Julia Formatter extension settings, add to the long list:
align_matrix=true
if you want to align matrix elements yourself.
Actually I don’t have the Julia Formatter
extension installed, I’m using the Crtl-Shift-P > Format Document
option of the Julia Language Support.
Is that it? I cannot find where to setup anything related to formatting.
Or should I install the Julia Formatter extension actually have options?
Use a .JuliaFormatter.toml
to configure this behaviour.
Where should it be placed? In the package dir, or somewhere else, for the effect to be global?
I installed it, but the options didn’t help.
I have:
x = [ 1 0
0 1 ]
with align_matrix=true
, formatting results in:
x = [1 0
0 1]
and with align_matrix=false
I have:
x = [1 0
0 1]
Thus, different things, but both bad.
A workaround is to not format it, with:
#! format: off
x = [ 1 0
0 1 ]
#! format: on
Actually, noticed now that it expects the multi-line matrix to be written as:
x = [
123 1234
0 10
]
which it then formats to:
x = [
123 1234
0 10
]
Meaning, it left-aligns the first column and removes any trailing space in the middle. Not good either.
@lmiq, sorry, I thought this was working but it isn’t.