PhpStorm not formatting HTML files

When I press Ctrl+Alt+L, html files do not get reformatted and instead I receive a message saying "No lines changed: content is already properly formatted".

below is a screenshot of the code after it has been 'formatted'




This only happens to HTML files, anything else (such as PHP, JS, CSS, Twig, etc) are fine.

Below is a screenshot of the settings I have in Code Style > HTML

Comment actions Permalink

Hi there,

Why that <html> opening and closing tags having a green background? Is that a current element (cursor is there) or something else?

In any case: please post a screenshot of your "Settings/Preferences | Editor | Language Injections". It's possible you some have created some bad injection rule...

Comment actions Permalink


thanks for your reply, the <html> tags were selected as my cursor was there. Below are the requested screenshots of my language injections settings;



There are two injections for HTML in this list, the first one (php: "<html>") has the following place pattern:

+ and(not(phpLiteralExpression().withSuperParent(2, phpFunctionReference().withName(or(string().startsWith("strip_tags"), string().startsWith("preg_"))))), phpLiteralMatchesBrics(".*\\</?<anyname>( .*)?(/)?>.*"))


The second one (php: <<<HTML) has the following place pattern:

+ phpLiteralExpression("HTML")


I can't see anymore in that list where the language column contains 'HTML'.

Hope this helps.

Comment actions Permalink

Your Language Injections are fine (all entries are bundled, no custom ones).

1) Try unchecking "Keep line breaks" option (2nd original screenshot). Unlikely to help but still...

2) What file icon those files have? Maybe they are associated with some another file type?

3) Maybe it's one of the custom plugins? Or even bundled one (especially if they are related to HTML (e.g. Vue/Angular). Try disabling them and check it again after restarting IDE

4) Look for any related hints in idea.log file (Help | Show Log in XXX)


Comment actions Permalink

Hi Andriy,

Thank you for your reply, below is the answers to your points.

1) Unfortunatley this didn't work

2) Below is a screenshot of the file type icon, it is a page with 'H' in a green bar at the bottom;

3) I disabled every plugin I have in my PHPstorm and the styling did in fact change, instead of styling it properly though, it just removed all indentation. - I think we might be on to something here. I'm going to go through each plugin individually to see if I can find which one is affecting the styling.

Comment actions Permalink

Found the problem, it was with a plugin called 'Svelte', which i have personally never heard of so don't know how it was installed in the first place, but at least it's been found now - thank you Andriy

Comment actions Permalink

It's a 3rd party plugin, not sure which one you have got though:

If it's a first one then it may be incompatible with latest IDE versions and it would be this ticket:  (sounds like your case exactly)

Try installing 2nd plugin if you need Svelte support.


Please sign in to leave a comment.