Vscode: Why do you auto format the code when I save the HTML file?

Created on 23 Jan 2017  路  5Comments  路  Source: microsoft/vscode

Why do you auto format the code when I save the HTML file?

This feature requires only a menu item with shortcut key

As an editor, why do you want to auto modify the code when do a save operate?
these two operations related? the save operate is edit command?

Why?!!!!!!

  • VSCode Version: Code 1.8.1 (ee428b0eead68bf0fb99ab5fdc4439be227b6281, 2016-12-19T14:49:23.350Z)
  • OS Version: Windows_NT ia32 10.0.14393
  • Extensions:

|Extension|Author|Version|
|---|---|---|
|code-gnu-global|austin|0.2.1|
|vscode-markdownlint|DavidAnson|0.6.1|
|jshint|dbaeumer|0.10.15|
|vscode-eslint|dbaeumer|1.2.2|
|python|donjayamanne|0.5.6|
|xml|DotJoshJohnson|1.7.0|
|tslint|eg2|0.8.1|
|CppSnippets|hars|0.0.5|
|beautify|HookyQR|0.7.3|
|vscode-JS-CSS-HTML-formatter|lonefy|0.2.2|
|MagicPython|magicstack|1.0.3|
|vscode-clang|mitaki28|0.2.1|
|cpptools|ms-vscode|0.9.3|
|csharp|ms-vscode|1.6.2|
|mono-debug|ms-vscode|0.12.0|
|Theme-MarkdownKit|ms-vscode|0.1.1|
|vs-keybindings|ms-vscode|0.1.3|
|debugger-for-chrome|msjsdiag|2.4.2|
|debugger-for-edge|msjsdiag|0.4.1|
|Spell|seanmcbreen|0.9.1|
|python|tht13|0.2.3|
|unity-debug|Unity|1.1.0|


Steps to Reproduce:

1.
2.

*caused-by-extension editor formatting html

Most helpful comment

Well, first of all, as far as we know, VS Code has not (yet) reached the point of sentience, so I don't think the _editor_ wants to do anything. For now, it's just us measly humans who are conspiring against you. :wink:

Secondly, unfortunately I can't reproduce the issue. Let's try and narrow it down:

  1. Try running vscode w/ extensions disabled. You can do this by running code --disable-extensions from the command line (also stay in this mode for all the future steps)
  2. Check your VS Code settings - in particular, you'll want to ensure that the "editor.formatOnSave" feature is off (by default, it should be)
  3. Does it happen in file types other than HTML?

All 5 comments

Well, first of all, as far as we know, VS Code has not (yet) reached the point of sentience, so I don't think the _editor_ wants to do anything. For now, it's just us measly humans who are conspiring against you. :wink:

Secondly, unfortunately I can't reproduce the issue. Let's try and narrow it down:

  1. Try running vscode w/ extensions disabled. You can do this by running code --disable-extensions from the command line (also stay in this mode for all the future steps)
  2. Check your VS Code settings - in particular, you'll want to ensure that the "editor.formatOnSave" feature is off (by default, it should be)
  3. Does it happen in file types other than HTML?

You are right,this problem is caused by the extension "JS-CSS-HTML Formatter"
I do not know what it is, when I open some type file, VS code suggests some plugins I can install, for example: jshint
as a nodejs based editor, I think maybe VS code is missing some dependencies for editing or debugging,
So I installed all suggested plugins, and now the problem occurred!

Thank you!

Rock on! :rocket:

Also, thanks for sharing your thought process! We wanted to make it easy to discover all the VS Code ecosystem has to offer, so we try to recommend some extensions based on the types of files you're working with, but I do wonder if this might actually have an opposite-than-intended effect.

cc @chrmarti, @seanmcbreen - may be worth looking into as part of your investigations with the "welcome" experience.

Was having the same issue and it was because editor.formatOnSave was set to true. Switching to false fixed this. Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

filfat picture filfat  路  246Comments

lw-schick picture lw-schick  路  229Comments

hsdk123 picture hsdk123  路  263Comments

ghost picture ghost  路  234Comments

Brakkar picture Brakkar  路  364Comments