Format code php and html in a tpl file - html tag spaces

Hi all. Don't remember having this prob before I had to do an os clean reinstall. Setting.jar was backed up. If I now reformat code in a tpl file that has php and html code,it adds spaces to the html tags e.g. <div>  to < div > . Even the code style (php) is showing it.

Don't remember this happening before. So somehow I have changed something or not changed something. Simply don't know what setting would correct this.
Any help for a part timer, self taught, would be appreciated .

Regards Steve
phpstorm v9.02 & tried latest eap version
windows 10 pro

6 comments
Comment actions Permalink

Hi there,

it adds spaces to the html tags e.g. <div>  to < div >

There is option to insert space after tag name (disabled by default) to make it <div > ... but there is nothing to insert space before the tag name as it simply makes code invalid.

Even the code style (php) is showing it

Can you clarify please? Screenshots etc.

-----

Q: is the space really there .. or is it just looks like a space? Quite possibly it's just a font / rendering issue (although in sich case it should affect more than just <> symbols). But try different font anyway.

0
Comment actions Permalink
Hi Andriy, yes, the space is really there. It renders the tags and content as normal text after reformat. But your probably on the right track.
Regards Steve


Attachment(s):
beforeAndAfter-reformat.jpg
php_codestyle.png
0
Comment actions Permalink

Still not clear for me on what it could be (very weird behaviour)

1) Please switch to Default color schema for now (it may provide some hints)
2) Does it happens with this file only, with all *.tpl.php .. or with ALL *.php files ?
3) Does it happens with ALL tags or DIV only?
4) Does it happen in actual *.html files?
5) Please show screenshot of the whole file (I'm interested in first places where it starts happening)
6) Make sure that ALL 3rd party plugins (not bundled by default) are disabled -- to filter out such possibility
7) If you have textMate bundles support enabled -- please disable it for now as well
8) Did you associate such *.tpl.php pattern (or whatever) with any other file type? (e.g. there was an issue in 9.0.1 where files with more than one extension were affected)

On your screenshot .. the <! has different color than the rest of the HTML comment (before and after reformat) -- it should not be like that

0
Comment actions Permalink

Yes i agree very weird.

1) Please switch to Default color schema for now (it may provide some hints)

Done: Same

2) Does it happens with this file only, with all *.tpl.php .. or with ALL *.php files ?

all *.tpl and if i change the extension to .php. Sorry no html in the php files.

3) Does it happens with ALL tags or DIV only?

not with "br a h1 img strong ul li" , does with "select option div"

4) Does it happen in actual *.html files?

No

5) Please show screenshot of the whole file (I'm interested in first places where it starts happening)

attached the start screenshot

7) If you have textMate bundles support enabled -- please disable it for now as well

Done: Same

8) Did you associate such *.tpl.php pattern (or whatever) with any other file type? (e.g. there was an issue in 9.0.1 where files with more than one extension were affected)

just Php has .tpl associated in file types. Removed .tpl from smarty. the file s are just *.tpl

On your screenshot .. the <! has different color than the rest of the HTML comment (before and after reformat) -- it should not be like that

I noticed that too. Its like it doent recognise it as html??



Attachment(s):
default.JPG
0
Comment actions Permalink

1) Try resetting your Code Style to Defaults (e.g. try creating new Code Style schema)

2) Settings/Preferences | Language & Frameworks | Template Data Languages -- do you have anything assigned manually for such file? Although If *all* files with such extension affected this should not really be an issue (unless they all in some common folder)

3) "Sorry no html in the php files." What do you mean by this?

4) Do you have code completion for HTML tags in such file(s)?

5) If you fix the code (e.g. remove unwanted space on line 13 from your screenshot) will completion/coloring will be OK?

6) What sort of errors/warnings IDE finds if you run "Code | Inspect Code..." on such file (even before reformatting)?

7) Anything interesting in idea.log (Help | Show Log in...) ?

8) If you press Alt+Enter (or via the light bulb) while having cursor on such presumably HTML code (before and after reformat) -- what kind of menu do you see there? I'm looking for some hints that would tell what language is this. Because right now it does not seem to be HTML.

9) Try something more radical: close project; backup and delete .idea subfolder (your project settings); use "Open" and point to the project root & configure project from scratch.

If nothing -- try the same with IDE settings while IDE is closed


It's very hard for me to suggest something without being able to see it live and see the possible changes after altering the settings.

9.0.2 had some issues with importing settings (some config files got deleted after restart; e.g. I had issues with Live Templates, Keymap and Colors). I may suggest to try 9.5 EAP again; but delete 9.5 settings in advance and do not import anything on first launch -- see if it works OK. if does -- try importing your old/original settings (not the ones from current 9.0.2 installation)

0
Comment actions Permalink

Hi Andriy, you where spot on.I tried an old project simular file .tpl with both php and html code. Everything was fine. So you where right it is to do with the .idea folder produced when setting up a new project and settings import. Which is exactly what i am doing.
So you have got me in the correct area, for some later troubleshooting. But for now i need to get the job done.
I have got this far:
Everything back to default, deleted the .idea folder, in the root of the new project. Then opened the folder to start a new project without importing my old settings.

Thanks Steve

0

Please sign in to leave a comment.