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] formatting option "html.format.extraLiners" doesn't work #4261

Closed
weinand opened this issue Mar 15, 2016 · 3 comments
Closed

[html] formatting option "html.format.extraLiners" doesn't work #4261

weinand opened this issue Mar 15, 2016 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug html HTML support issues verified Verification succeeded
Milestone

Comments

@weinand
Copy link
Contributor

weinand commented Mar 15, 2016

testing #4066

  • use this html:
<HTML><HEAD><TITLE>Your Title Here</TITLE></HEAD><BODY BGCOLOR="FFFFFF"><CENTER><IMG SRC="clouds.jpg" ALIGN="BOTTOM"> </CENTER><HR> <a href="http://somegreatsite.com">Link Name</a> is a link to another nifty site<H1>This is a Header</H1><H2>This is a Medium Header</H2> Send me mail at <a href="mailto:support@yourcompany.com">support@yourcompany.com</a>.<P> This is a new paragraph!<P><B>This is a new paragraph!</B><BR><B><I>This is a new sentence without a paragraph break, in bold italics.</I></B><HR></BODY></HTML>
  • change html.format.extraLiners from null to HEAD

Observe:

<HTML>
<HEAD>
    <TITLE>Your Title Here</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
    <CENTER>
        <IMG SRC="clouds.jpg" ALIGN="BOTTOM"> </CENTER>
    <HR> <a href="http://somegreatsite.com">Link Name</a> is a link to another nifty site
    <H1>This is a Header</H1>
    <H2>This is a Medium Header</H2> Send me mail at <a href="mailto:support@yourcompany.com">support@yourcompany.com</a>.
    <P> This is a new paragraph!
        <P>
            <B>This is a new paragraph!</B>
            <BR>
            <B><I>This is a new sentence without a paragraph break, in bold italics.</I></B>
            <HR>
</BODY>
</HTML>

There is no extra line before the HEAD tag.

  • change html.format.extraLiners to null

Observe: now there is an extra line before the HEAD and BODY tags:

<HTML>

<HEAD>
    <TITLE>Your Title Here</TITLE>
</HEAD>

<BODY BGCOLOR="FFFFFF">
    <CENTER>
        <IMG SRC="clouds.jpg" ALIGN="BOTTOM"> </CENTER>
    <HR> <a href="http://somegreatsite.com">Link Name</a> is a link to another nifty site
    <H1>This is a Header</H1>
    <H2>This is a Medium Header</H2> Send me mail at <a href="mailto:support@yourcompany.com">support@yourcompany.com</a>.
    <P> This is a new paragraph!
        <P>
            <B>This is a new paragraph!</B>
            <BR>
            <B><I>This is a new sentence without a paragraph break, in bold italics.</I></B>
            <HR>
</BODY>

</HTML>
@aeschli aeschli self-assigned this Mar 16, 2016
@weinand weinand added the bug Issue identified by VS Code Team member as probable bug label Mar 16, 2016
@weinand weinand changed the title html formatting option "html.format.extraLiners" html formatting option "html.format.extraLiners" doesn't work Mar 16, 2016
@aeschli aeschli added the html HTML support issues label Mar 16, 2016
@aeschli aeschli changed the title html formatting option "html.format.extraLiners" doesn't work [html] formatting option "html.format.extraLiners" doesn't work Mar 16, 2016
@aeschli aeschli added this to the March 2016 milestone Mar 16, 2016
@aeschli
Copy link
Contributor

aeschli commented Mar 16, 2016

fixed by 4b36383

@aeschli aeschli closed this as completed Mar 16, 2016
@aeschli aeschli assigned weinand and unassigned aeschli Mar 18, 2016
@weinand weinand added the verified Verification succeeded label Mar 21, 2016
@enbo
Copy link

enbo commented Jun 4, 2016

Not sure if I should have opened a new issue or not. "html.format.extraLiners" doesn't work with some tags.

  • VSCode Version: Version 1.1.0 (1.1.0)
  • OS Version: OS X 10.11.5 (15F34)

Steps to Reproduce:

  1. Create an HTML file.

  2. Paste the following into the HTML file:

    <body>
      <h1></h1>
      <h2></h2>
      <h3></h3>
      <h4></h4>
      <h5></h5>
      <h6></h6>
      <address></address>
      <dl>
        <dd></dd>
        <dt></dt>
      </dl>
      <hr>
      <pre></pre>
    </body>
  3. In your settings, add

    "html.format.extraLiners": "h1, h2, h3, h4, h5, h6, address, dt, hr, pre"
  4. Right-click on text in the HTML file, and select Format Code.

  5. Nothing changes in the HTML file.

What should happen instead:

<body>

  <h1></h1>

  <h2></h2>

  <h3></h3>

  <h4></h4>

  <h5></h5>

  <h6></h6>

  <address></address>
  <dl>
    <dd></dd>

    <dt></dt>
  </dl>

  <hr>

  <pre></pre>
</body>

@mlewand
Copy link
Contributor

mlewand commented Feb 21, 2017

It looks like there's a regression, as if VSCode would no longer respect html.format.extraLiners config.

  • VSCode Version: Code 1.9.1 (f9d0c68, 2017-02-09T00:26:45.394Z)
  • OS Version: Windows_NT ia32 10.0.14393
  • Extensions:
Extension Author Version
html-snippets abusaidm 0.1.0
jslint ajhyndman 1.2.1
Bookmarks alefragnani 0.11.0
ck4-test-mate mlewand 0.0.1
jsrefactor cmstead 0.5.3
jshint dbaeumer 0.10.15
vscode-eslint dbaeumer 1.2.6
copy-relative-path enochc 0.1.1
beautify HookyQR 0.8.4
copy-markdown-as-html jerriepelser 1.0.0
docthis joelday 0.4.0
copy-github-url mattlott 0.1.0
vscode-exec-node miramac 0.2.1
ecdc mitchdenny 0.10.3
select-part-of-word mlewand 0.2.0
debugger-for-chrome msjsdiag 2.5.3
promise-snippets progre 0.2.3
vscode-open sandcastle 0.1.0
code-settings-sync Shan 2.4.4
code-spell-checker streetsidesoftware 0.14.6
selectline-statusbar tomoki1207 0.0.1
vscode-react-native vsmobile 0.3.1
change-case wmaurer 1.0.0
JasmineSnippets xabikos 0.2.1
JavaScriptSnippets xabikos 1.4.0

Steps to Reproduce:

  1. Set your "html.format.extraLiners" to "head,body,div,p,/html".
  2. Open new tab with ctrl+n.
  3. Switch tab language to HTML.
  4. Set a following markup:
    <!DOCTYPE html>
    <html lang="en">
    	<head>
    		<title></title>
    		<meta charset="UTF-8">
    		<meta name="viewport" content="width=device-width, initial-scale=1">
    		<link href="css/style.css" rel="stylesheet">
    	</head>
    	<body>
    		<div>foo</div>
    		<div>foo</div>
    		<div>foo</div>
    		<p>foo</p>
    		<p>foo</p>
    		<p>foo</p>
    	</body>
    </html>
  5. Press ctrl+shift+f to execute Format Document command.

Expected

Lines are inserted also after p and div elements.

<!DOCTYPE html>
<html lang="en">

	<head>
		<title></title>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link href="css/style.css" rel="stylesheet">
	</head>

	<body>
		<div>foo</div>

		<div>foo</div>

		<div>foo</div>

		<p>foo</p>

		<p>foo</p>

		<p>foo</p>

		</body>

</html>

Actual

Missing new lines after div or p.

<!DOCTYPE html>
<html lang="en">

	<head>
		<title></title>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link href="css/style.css" rel="stylesheet">
	</head>

	<body>
		<div>foo</div>
		<div>foo</div>
		<div>foo</div>
		<p>foo</p>
		<p>foo</p>
		<p>foo</p>
	</body>

</html>

@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
bug Issue identified by VS Code Team member as probable bug html HTML support issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants