Skip to content
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

"html.format.wrapAttributes": "force-aligned" adds empty line on long attributes #1403

Closed
borisyordanov opened this issue May 31, 2018 · 1 comment

Comments

@borisyordanov
Copy link

  • VSCode Version: 1.23.1
  • OS Version: macOS 10.14.4

Steps to Reproduce:

  1. Add a long attribute to an html tag
  2. Format the html tag with the following user setting:
    "html.format.wrapAttributes": "force-aligned",

Does this issue occur when all extensions are disabled?: Yes

This is what an html tags with a few not very long looks like after it has been formatted(the attributes are aligned one below each other in VSC, but markdown is being stupid):

<input type="text"
	   class="form-control"
	   ng-model="shipment.date"
	   value="shipment.date"
	   placeholder="Shipped on">

Which what is expected.

The problem occurs if you go nuts and add longer attribute, which happens to me quite often on AngularJS apps:

<button class="btn btn-primary"
		ng-click="shipment.editSendDate = false;sampleTracking.updateShipmentDates({shipment_id: shipment.shipment_id, sent_timestamp: shipment.sending_date})"

		type="button">Save</button>

The empty line between the ng-click and type attributes is not something that i added - the formatter does.

If i change the ng-click to be 107 characters or less the empty line is not added. If it is more that 107, like the example above, a newline is added when you format the document.

@bitwiseman
Copy link
Member

Settings:

{
    "wrap_attributes": "force-aligned"
}

Input:

<button class="btn btn-primary" ng-click="shipment.editSendDate = false;sampleTracking.updateShipmentDates({shipment_id: shipment.shipment_id, sent_timestamp: shipment.sending_date})" type="button">Save</button>

Output (expected and actual in 1.8.0-rc4)

<button class="btn btn-primary"
        ng-click="shipment.editSendDate = false;sampleTracking.updateShipmentDates({shipment_id: shipment.shipment_id, sent_timestamp: shipment.sending_date})"
        type="button">Save</button>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants