Beautifying for Object Script ?
This a spin of from For and If with one line: to brace or not to brace
Has anyone seen or heard of a Beautifier for Object Script?
There is a bunch of them out for XML, HTML, JavaScript, CSS, PHP, .... https://codebeautify.org/
What I think of is a utility / package that is able to
- #1 format your source code by appropriate Tabs/Spaces
- #2 (more important) - to replace legacy notation with bracket notation - to wrap all kind of (post-)conditions in JavaScript style
I'ts definitely a tricky thing.
And I never head of any attempt to do it.
A simple example:
IF a=2 set b=2
ELSE set b=0
ELSE set b=0
might become
set $TEST= (a=2)
IF ($TEST) { set b=2 }
ELSE {set b=0 }
IF ($TEST) { set b=2 }
ELSE {set b=0 }
to move to brackets and maintain $TEST correctly
Also covering all the other strange things you know all
Would be good if we get this for Object Script. May be better to understand how Atelier editor does format the code.
That looks very interesting.
Leaving the decision what change to apply to the developer is well acceptable.
Syntax Checker is probably more important!
And at a first glance it seems well suited to also control progress and impovement!
Unfortunately, it is not so easy to implement it without a good parser. InterSystems still don't want to publish any sort of parsers. And not sure they have plans to implement it in Atelier, yet. While we still have so many troubles in Atelier, it would be better if they will fix it first. And then it would be possible to ask, hope it will not take so long.
In your case, it is not only beautifier it is also static syntax check. Which can recommend changing some bad practices/old school/possible error code. And it is done by project CacheQuality
Oops ! where ?? how ??
do you refer to Edit / Advanced ?
I think that's not it. There was some keyboard command that formatted all commands/functions.
@Alexander Koblov?
I'm aware only of Edit -> Advanced item "Expand Commands" (Ctrl-E).
It is visible only for routines, but shortcut also works for classes.
Select some code, hit Ctrl-E. All commands, functions will be expanded to full name.
I usually do Ctrl-A, Ctrl-E.
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...
THX !
Studio has a built-in code beautifier.