MBeautifier
MBeautifier copied to clipboard
Auto-wrapping long lines
It's probably a quite tricky thing to implement, but it would be nice if there was an option to autowrap long (e.g., > 79 chars) lines. Some sort of heuristics could be used to figure out where to break the lines, e.g., first try breaking at "=". Then if either of parts is still too long, break farthest down the line that puts the line (w/ added ...) under the line limit.
I will think about this one also. In the current structure it is really difficult to implement such a thinkg (this project started to provide really basic and limited formatting capabilities, and then as the requirement list was growing, I had to attach new things to the existing structure as I never had enough time to re-build it completely.) Originally I wanted to discontinue the project as I was expecting R2017 to be shipped with auto-format feature, but as it found out that this feature still does not exists (and seems not to be planned for R2018) I decided that I will do a java based reimplementation because I had problems coming from ML version-differences and I also expect a performance jump. Long story short: I will investigate the possibility to add this feature in the last M-based release. It I feel it realyl cumbersome, I will try to keep this in mind when doing the architecture for the java-based version :)
Sounds like a very nice feature to add. I accidentally saw an implement of Matlab for a similar feature, they use it for the function "publish". I didn't understand how exactly it works, but it resides inside matlabroot\toolbox\matlab\codetools\private\evalmxdom.m . The relevant piece there is:
% For consistency, set the published output to 80 columns, regardless of % the current Command Window width. originalEightyColumns = feature('EightyColumns'); resetEightyColumnsObj = onCleanup(... @()feature('EightyColumns',originalEightyColumns) ); feature('EightyColumns',1)
If someone would investigate it and can add it to that tool, it will be cool.