* Added calculation formatting function with ƒ button for custom function and calculation dialogs.
Love this! So excited to finally see something like this in the function.
Obviously this one is going to be rather difficult to suit everyone given everyone has their own opinion on proper calculation formatting.
However there is likely to be some rules which any formatting could abide by. It would be good to start a discussion on these. It may be that some could easily be made into a preference so developers could choose their own formatting preferences?
The first one I just wanted to identify is spacing. I'm going to use the following completely unformatted calculation as an example:
Your formatting function yields this:
Let([ test = 1; test2 = 3; test4 = 3 ]; If( test = test2; test4; ""))
Just a couple of points on these:
I always put spaces between any operators or separators. So this is brackets rounded/square, semicolons, =, + and so on. This could be something achievable (maybe as a preference as not all users like spaces) There would only be minor changes on the above to introduce spaces between semicolons on end of lines, and the "Let" and its open bracket, and a few other places. Some spacing has already bee introduced around operators and after semicolons currently.
The result of the Let statement (the IF statement) I'd probably put on a new line under "];" line and with the same indentation as the variable declarations. The very final close bracket would be on its own line in-line with the Let.
In other words something like this:
Let ( [ test = 1 ; test2 = 3 ; test4 = 3 ] ; If ( test = test2 ; test4 ; "" ) )
I completely understand that calculation formatting is tricky business and everyone will have their own 2 cents on the discussion so feel free to just disregard these comments go with any approach you see fit.
I do like that the If statement in this case is all on a single given it is short enough. It's a very had thing to decide when to split an If statement onto multiple lines like this:
if ( condition ; result true ; result false )
simply because it usually depends on the length of the overall if statement and whether splitting improves or degrades readability. Again perhaps this could end up being user preference - some users might prefer a default of no splitting, while others prefer it.
I'm also aware too your MBS preferences dialog is getting quite large and full of stuff! Do you have any ability to modify that dialog window to have multiple tabs for the preferences?
Thanks for all the great work! I absolutely love this function already.