davidvarga / MBeautifier

MBeautifier is a MATLAB source code formatter, beautifier. It can be used directly in the MATLAB Editor and it is configurable.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spacing in function arguments affected by MatrixIndexing_ArithmeticOperatorPadding

MaxGaukler opened this issue · comments

Function arguments don't get the same spacing as normal brackets if MatrixIndexing_ArithmeticOperatorPadding is 0. I suggest setting the default of this value to 1.

3 * (1 + 2)
trace(1+2)

The default value was set as requested. For now it is safer, as currently it is not identified whether the preceeding name is a container or a function. I could find anything to identify this unfortunately. Anyways a bug was fixed with this card.

Thanks. I think it's nearly impossible to reliably find out whether something is a function, as this could even change dynamically:

>> add = @(a,b) a+b;
>> add(1,2)
ans = 3
>> add = 1:10;
>> add(1,2)
ans = 2

(example taken from https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2644618/ )

Sometimes, even the matlab editor doesn't know how to autocomplete foo.bar as it has no idea which class foo has. As in the example above, foo.bar(1,2) could be a function or a matrix-indexed property.

Yes, that's my final thought on the topic too. The main problem is that the Matlab path in the time of the formatting is not sure to be the same as in the time of execution, so this will remain like this for now.