You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We would like to add the Prettier method to the vtlengine library. The main goal is to migrate from the old engine the prettier method based on the AST Template.
Tasks to perform
Generate the prettier method at API. The input will be a vtl script and the output will be the same vtl script, but formatted:
defprettier(script: str) ->str:
....
Generate an internal function called stringify and a AST Template method called ASTStringify that will take the AST Object and it will extract the string representation. This string representation will include as well all children, and perform indentation where needed.
Add some tests with unformatted code and formatted code
On complex operators (like aggregation, analytic, joins), we open the ( and jump to the next line, adding some indentation (4 spaces or tab). We fill the code and close the )
On clause operators, we jump to the next line before adding the [ and jump another line and adding indentation. We here fill each clause on each line and jump another line to close the operator with ]
Examples of pretty code
The text was updated successfully, but these errors were encountered:
Overview
We would like to add the Prettier method to the vtlengine library. The main goal is to migrate from the old engine the prettier method based on the AST Template.
Tasks to perform
stringify
and a AST Template method calledASTStringify
that will take the AST Object and it will extract the string representation. This string representation will include as well all children, and perform indentation where needed.Important
This is a hard requisite for #67
How do we pretty up code
Examples of pretty code
The text was updated successfully, but these errors were encountered: