code reformat not working in blade or html

Just as the title says. The reformat code (or indent code) function is not working for any HTML code. This happens in both blade and HTML files. Can't be any more explanatory than this. CTRL+ALT+L simply doesn't do anything for HTML.

I already took a look at the HTML code style and cleared the "do not indent children of" field.

any ideas?

9 comments

Hi there,

any ideas?

Yes.

Code Reformat is not yet implemented for blade templates -- http://youtrack.jetbrains.com/issue/WI-24357

But it does work in .html files though (just tested).

0

Same problem here. Working on a Mac with PhpStorm 8.0.3. Inside HTML files the editor does simply nothing, but works for eg. JavaScript files. Very strange.

Are there only two people having this problem?

0

What are the steps to reproduce? Are you invoking reformat action with shortcut or from the PhpStorm menu?

0

Tried all three ways I know. From the menu, via shortcut and via copy/paste.

And I'm not sure if there should be, but here, there is definitly no popup box with options, etc.

0
And I'm not sure if there should be, but here, there is definitly no popup box with options, etc.

For PhpStorm v8 -- "Preferences | Editor | Show "Reformat Code" dialog" -- make sure it's enabled.

For PhpStorm v9 -- Reformat does not show such dialog anymore as it always context dependant. To see dialog you have to use different shortcut for different action -- just search your "Preferences | Keymap" for "reformat" keyword.

Some suggestions to check:

  • Set your code style to Default -- any difference?
  • Try disabling all 3rd party (not bundled by default) plugins and restart IDE
  • Backup and delete ALL IDE settings (to start from scratch) -- does it work now?
0

Hej, that worked. Put it back to default and enabled the popup fixed it.

Thank you so much!

0

I know this is a bit old topic but...

I had the same problem with Phpstorm v2017.2, and it come from: "Settings | Editor | Code Style | HTML | Other | Keep white spaces" that totally break the code reformat !

 

3

Formatter doesn't touch tags from keep white spaces inside: list - this must be the issue

1

To clarify: if you highlight a section of HTML and attempt to reformat it with WebStorm's Ctrl-Alt-L "Reformat code" command, an element configured as "keep white spaces inside" (see image below) will not be reformatted, and this includes the tags themselves.  So for example if Settings are configured as below, a <span> tag that is not properly indented will not be corrected by Ctrl-Alt-L.

However, I find that auto-indent can be used to deal with this case: join the line beginning with <span> with the line above it (move cursor to line above and Ctrl-Shift-J), then hit Enter and the <span> element is correctly indented.

0

Please sign in to leave a comment.