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" and "force-align" breaks indentation #19727

Closed
tiago-plank opened this issue Feb 2, 2017 · 6 comments
Closed
Assignees

Comments

@tiago-plank
Copy link

  • VSCode Version: Code 1.9.0 (27240e7, 2017-02-02T08:31:00.827Z)
  • OS Version: Windows_NT ia32 6.3.9600
  • Extensions: All extensions disabled

Steps to Reproduce:

  1. Set html.format.wrapAttributes to force or force-align
  2. Write an html tag with 2 or more attributes
  3. Execute editor.action.formatDocument

Sample html:

<div attr-1 attr-2 attr-3>
    <p>Test</p>
</div>

Expected result:

<div attr-1
    attr-2
    attr-3>
    <p>Test</p>
</div>

Actual result:

<div attr-1
    attr-2
    attr-3>
    <p>Test</p>
    </div>

@eamodio
Copy link
Contributor

eamodio commented Feb 3, 2017

I also didn't notice a difference between force and force-align, I expected force-align to align the attributes to the first unwrapped attribute, but that doesn't seem to be the case.

@kf-ireneuszpatalas
Copy link

Hi guys,

I don't know why, but it's another application using jsbeautifier which haven't read the documentation carefully. The correct option for wrapAttributes is force-aligned, not force-align.
VS Code will treat is as warning, but it will work and correctly wrap attributes and align them to first one.
Still the result is not correct:

<div attr-1
     attr-2
     attr-3>
    <p>Test</p>
    </div>

That's another story and is already reported here beautifier/js-beautify#1103

@aeschli
Copy link
Contributor

aeschli commented Feb 3, 2017

Good catch with the wrong settings schema: I created #19849, planed for the next rebuild.

@aeschli
Copy link
Contributor

aeschli commented Feb 3, 2017

Closing this issue. Waiting for beautifier/js-beautify#1103 to be fixed.

@aeschli aeschli closed this as completed Feb 3, 2017
@Montago
Copy link

Montago commented Jun 8, 2017

Would it be possible to extend the options of wrapping with "auto-align" ??

"force-align" will force wrapping + aligning them...

but let say i don't want to wrap EVERY SINGLE HTML ELEMENT, but only the long ones - and then do them manually ..

so, "auto-align" would only align those that are already wrapped.

@aeschli
Copy link
Contributor

aeschli commented Jun 8, 2017

@Montago Please file suggestions to https://github.com/beautify-web/js-beautify which is the formatter we use.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants