question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrap and align html attributes when line reaches wrap-line-length

See original GitHub issue

Description

I would like to get the combination of the power of : "wrap-attributes": "force-aligned", "wrap-line-length": 120 If my line reaches the wrap-line-length, it should wrap the whole line and align them with the previous line.

Input

The code looked like this before beautification:

<p-dataTable
    [value]="data"
    [(selection)]="selectedRows"
    (selectionChange)="onSelectionChange($event)"
    [editable]="editable"
    [selectionMode]="settings.selectionMode"
    [resizableColumns]="settings.resizable"
    [reorderableColumns]="settings.reorderable"
    responsive="true"
    scrollable="true"
    scrollHeight="550px"
    [lazy]="settings.lazy"
    [totalRecords]="totalRecords"
    [paginator]="settings.paginator"
    [rows]="settings.paginator?.rowsPerPage || 10">
</p-dataTable>

Expected Output

The code should look like this after beautification with that feature:

<p-dataTable [value]="data" [(selection)]="selectedRows" (selectionChange)="onSelectionChange($event)" [editable]="editable"
             [selectionMode]="settings.selectionMode" [resizableColumns]="settings.resizable" [reorderableColumns]="settings.reorderable"
             responsive="true" scrollable="true" scrollHeight="550px" [lazy]="settings.lazy" [totalRecords]="totalRecords"
             [paginator]="settings.paginator" [rows]="settings.paginator?.rowsPerPage || 10">
</p-dataTable>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:12
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

20reactions
dietergeertscommented, Feb 14, 2018

A side note on this: I was actually looking for the combination of those two settings, but now like the proposed example. What I need is that VSCode leaves attributes alone, and when the element becomes longer than 120, it will allign the attributes on new lines, so what I would want is the following:

<div class="form-check form-group row">
  <label class="custom-control custom-checkbox" id="referral-filter-checkbox-label">
    <input type="checkbox" class="custom-control-input" id="referral-filter-checkbox" ng-checked="$ctrl.filterReferralsRx | async : this" ng-click="$ctrl.toggleFilterReferrals()">
    <input type="checkbox" class="custom-control-input"
           id="referral-filter-checkbox" 
           ng-checked="$ctrl.filterReferralsRx | async : this" 
           ng-click="$ctrl.toggleFilterReferrals()">
    <span class="custom-control-indicator"></span>
    <span class="custom-control-description text-nowrap">{{ 'MODEL.INBOX.ACTION.FILTER' | translate }}</span>
  </label>
</div>

to:

<div class="form-check form-group row">
  <label class="custom-control custom-checkbox" id="referral-filter-checkbox-label">
    <input type="checkbox"
           class="custom-control-input"
           id="referral-filter-checkbox"
           ng-checked="$ctrl.filterReferralsRx | async : this"
           ng-click="$ctrl.toggleFilterReferrals()">
    <input type="checkbox" class="custom-control-input"
           id="referral-filter-checkbox" 
           ng-checked="$ctrl.filterReferralsRx | async : this" 
           ng-click="$ctrl.toggleFilterReferrals()">
    <span class="custom-control-indicator"></span>
    <span class="custom-control-description text-nowrap">{{ 'MODEL.INBOX.ACTION.FILTER' | translate }}</span>
  </label>
</div>

Notice the second input, where it should leave the attributes alone, because they are not longer than 120 characters + they are already aligned.

So what I would like to see is instead of a force, make sure they are aligned when on multiline, and put them multiline when the line goes over 120 characters.

3reactions
auderercommented, May 28, 2018

This is highly desired. @cheerypick are you still planning on making a PR for this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio Code - force code formatting to wrap attribute ...
So expected behavior is to have line wrapped when the max length of the line is exceeded. However I do not want to...
Read more >
Getting rid of VSCode's attribute wrapping in HTML files
The default value for wrapAttributes is auto , which instructs VSCode to wrap attributes when a certain line length is exceeded. The line...
Read more >
VS Code Setting: html.format.wrapAttributes - YouTube
Want to master VS Code? Click here: https://andrecasal.com/courses/mastery-for-vs-codeWant to upgrade web dev skills?
Read more >
Options - Prettier
Print Width. Specify the line length that the printer will wrap on. For readability we recommend against using more than 80 characters: In...
Read more >
User and Workspace Settings - Visual Studio Code
inherit: Lines will wrap according to the `editor. ... HTML support for the custom HTML tags, attributes and attribute values you specify in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found