matlab-formatter-vscode icon indicating copy to clipboard operation
matlab-formatter-vscode copied to clipboard

error with dealing the 'end' in index position

Open changlichun opened this issue 1 year ago • 1 comments

The formater does not perform well in such a snippet

for i = 1:22

    if i > 3 && i < a(end - 1)
        break
    else
        continue
    end

end

Wrongly format to

for i = 1:22

    if i > 3 && i < a( end - 1)
    break
else
    continue
end

end

In addition, behave well in quite a similar code

for i = 1:22

    if i > 3 && i < a(end)
        break
    else
        continue
    end

end

changlichun avatar Jan 14 '24 09:01 changlichun

I am having the same issue, would be great if this is fixed

akshatd avatar Jul 11 '24 06:07 akshatd