-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Feature Request: Control flow schematic formatter option to preserve newlines #53494
Copy link
Copy link
Closed
Labels
area: migrationsIssues related to `ng update`/`ng generate` migrationsIssues related to `ng update`/`ng generate` migrationscore: control flowIssues related to the built-in control flow (@if, @for, @switch)Issues related to the built-in control flow (@if, @for, @switch)
Milestone
Description
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
The new control flow migration is a marvellous bit of engineering, however the formatter has a troublesome side-effect of removing all newlines from the templates. It would be preferable were the migration formatter to take a more minimalistic approach to formatting, only adding newlines / whitespace where the control flow code is added to the html templates.
Proposed solution
Add a property to the control migration schema to preserve existing newlines when formatting. And naturally, the formatter should thus obey this.
Something like:
"preserveNewLines": {
"type": "boolean",
"description": "Preserve newlines when formatting",
"x-prompt": "Should existing newlines be preserved when formatting?",
"default": "false"
}
Alternatives considered
There are other formatters such as prettier, which is too opinionated, or beautify-js does not yet support the new control flow syntax.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: migrationsIssues related to `ng update`/`ng generate` migrationsIssues related to `ng update`/`ng generate` migrationscore: control flowIssues related to the built-in control flow (@if, @for, @switch)Issues related to the built-in control flow (@if, @for, @switch)