-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Suggestion] Cleanup empty lines/sections #347
Comments
I really like this idea @fvet! But I would actually not want any empty lines at all between two fields... So I would prefer this
to be this
But maybe that is just me..? I'm using Prettier when working with MarkDown and TypeScript and really like the cleanness that it produces - maybe someone should give it a go and create an AL Plugin for Prettier? 😁 |
@jwikman I in fact am in favour to remove the extra lines between the fields as well. Didn't want to go in detail on that part yet, since in some other cases (e.g. between procedures, regions, code, ...) I want to keep the empty line. BAD CODE
GOOD CODE
|
Totally agree on that @fvet 👍 |
That's a good idea, I'll add it. |
I've released a new version of the extension, there are 2 new sets of commands that you can use:
You can also use these commands with code cleanup using these 2 new additional "alOutline.codeCleanupActions" setting values:
|
Will implement this right away. |
Old issue I know, but is it possible to call these from OnSave the way props etc can be sorted? |
I really love the various cleanup rules that improve the code reading and enforce uniform code layout. However, during code review, we often find ourselves doing some minor cleanup of redundant code, that could be automated by some additional 'Cleanup Actions'
In case a new line is followed by another new line, all extra new lines (except the first) could be removed / truncated. (see lines between field1 / field2)
Exception: if the new line is followed by a section end (
{
orend
) on could argue to remove the new line completely. (see lines within field2 section)BAD CODE
GOOD CODE
Also remove empty lines between end of section markers (
}
)BAD CODE
GOODCODE
Also see StefanMaron/BusinessCentral.LinterCop#174
By making use of various snippets, we are often left with 'empty' sections. These sections can be completely removed (as long as they contain no childs / code).
With sections, I refer to
fields
,keys
,fieldsgroups
,layout
,actions
... (carrying no identifier)BAD CODE
Table
Page
GOOD CODE
The text was updated successfully, but these errors were encountered: