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 javascript in html #5076

Closed
apoliszk opened this issue Apr 7, 2016 · 6 comments
Closed

[html] format javascript in html #5076

apoliszk opened this issue Apr 7, 2016 · 6 comments
Assignees
Labels
feature-request Request for new features or functionality html HTML support issues
Milestone

Comments

@apoliszk
Copy link

apoliszk commented Apr 7, 2016

  • VSCode Version:0.10.11
  • OS Version:win8

Steps to Reproduce:

  1. write js in a html file
  2. format code
  3. the indent of the second line in script tag is not right

20160407231107

@aeschli aeschli changed the title Code Formatting Issue [html] format javascript in html Apr 12, 2016
@aeschli aeschli added the html HTML support issues label Apr 12, 2016
@aeschli aeschli added this to the Backlog milestone Apr 12, 2016
@aeschli aeschli added the feature-request Request for new features or functionality label Apr 12, 2016
@aeschli
Copy link
Contributor

aeschli commented Apr 12, 2016

We currently do not format code inside HTML

@Oceanswave
Copy link

Oceanswave commented Jun 15, 2016

Ran into a similar situation, however in 1.2.1 JS code within script tags in a .aspx file has its indenting and line breaks removed.

Are you saying that this is a side effect of formatting code within html/aspx that code gets formatted?

E.g. HTML rules are being applied when shift-alt-f is run?

@moander
Copy link

moander commented Aug 31, 2016

Is this hard to implement or is it possible to just take the content of the <script> tag, run it trough whatever indentation method that is used for .js files and place the result back into the script tag?

@mrmlnc
Copy link
Contributor

mrmlnc commented Aug 31, 2016

@moander, see #8938. @aeschli started the implementation of support nested languages.

But

image

@moander
Copy link

moander commented Aug 31, 2016

Cool :)

I found an extension that seems to work btw. It formats <script> content on save.

ext install vscode-JS-CSS-HTML-formatter

@aeschli
Copy link
Contributor

aeschli commented Feb 7, 2017

Formatting of JavaScript in HTML got added in December.

@aeschli aeschli closed this as completed Feb 7, 2017
@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
feature-request Request for new features or functionality html HTML support issues
Projects
None yet
Development

No branches or pull requests

5 participants