Indentation broken for some functions on MATLAB R2021b
danielmeer opened this issue · comments
Daniel Meer commented
I don't know why but on MATLAB R2021b the call to editorPage.smartIndentContents();
does not always indent the code correctly.
Not all functions are affected:
- Working:
MBeautify.formatFile()
,MBeautify.formatFileNoEditor()
,MBeautify.formatFiles()
- Not working:
MBeautify.formatCurrentEditorPage()
,MBeautify.formatEditorSelection()
Example:
function testfunc()
a = 1;
b = 2;
if a == 1
b = 3;
else
b = 4;
end
b = 6;
end
gets formatted to
function testfunc()
a = 1;
b = 2;
if a == 1
b = 3;
else
b = 4;
end
b = 6;
end
Interestingly, the smart indent works correctly if I have the cursor on an empty line.
I found a workaround by calling editorPage.smartIndentContents();
twice (in MBeautify.indentPage()
). It's not the nicest solution though.
Daniel Meer commented
Pull request #112 fixes the issue.
davidvarga commented
I forgot to close the issue after merging your PR :)