Non-beautiful space in front of sizes in arguments block
FlorianPfaff opened this issue · comments
Hi,
thanks for keeping up the good work on this useful tool! One concerning the arguments block: The code
arguments
varname (2, 2) double
end
is changed into
arguments
varname(2, 2) double
end
which is not "beautiful" if you ask me. I know where this comes from - the numbers are interpreted as indices. However, in this context, they are a description of the expected size of the matrix. I think keeping the space there would make the code more beautiful.
Thanks for considering,
Florian
there is no way to for MBeautify to know that that space should be retained. varname isn't a keyword so it just thinks the indices next to it need to be right next to varname. I can't imagine a way for MBeautify to fix that, unless there was some extra logic to read a function's input arguments, and if there is an arguments
block, then treat the variable names differently as desired.
I acknowledge that this is work and am not saying anyone should do it - however, I do not think there would need to be an extra logic to parse input arguments. It should be enough to detect if one is in an arguments block and then look for lines starting with
\n\t* *([A-Za-z_0-9]* *\([0-9]* *,[0-9]* *)\) *
and ignore them (or turn multiple spaces into a single space to beautify it).
FYI - This also happens in properties blocks.