Slow response on .tpl files

I am using the trial version of phpstorm and I am very happy with it, so probably I'll purchase a license.

But I am facing a annoying problem:
When editing .tpl (smarty) files phpstorm freezes for 10 seconds every time I open a { or write inside a {} block.
I seems it is looking for something (autocompletion or whatever)

In the right side bar where shows with very much erros (so much yellow and red marks) and if I leave the mouse
over the eye icon on top of that bar a popup appears saying 550 errors, 500 warnings, 300 whatever and 711 typos.
Not sure what it means, but the smarty and php performs, so it confuses me a bit.
Attached comes the  .tpl file

It does not happen with php files, html and so, only on .tpl

What can i do? It is really anyoing and umproductive. If I want to work with .tpl's I should rename to .txt or whatever,
but then I loose the coloring, formatign and definetily any useful feature for .tpl files :-)

Thank you in advance

Comment actions Permalink

Hi Ivan,

First of all I would strong recommend splitting this file into smaller pieces -- much more easier to work with in any IDE, in particular in PhpStorm where it runs a lot of code analysis -- run the same number of inspections on file with 100 lines (over and over again -- after each important change) and the same on 1K lines -- there is a difference.

Another general suggestion -- separate HTML and JavaScript into separate files. Plus, including raw PHP into Smarty template ... yeah -- it defeats the main purpose why Smarty was invented in first place (although it could be not your own code or whatever -- it's a bad practice anyway).

But back to the topic:

  • line 69 -- you are opening <link> tag but closing </script> -- this makes all the mess -- PhpStorm treats HTML as JavaScript and via versa (it runs a lot of useless in this case inspections and mark a lot of code as invalid). Fixing </script> to be </link> improves typing {} speed a lot (at very least on my computer) and removes tons of errors/warnings.
  • All other possible errors you should be able to find and fix yourself (PhpStorm helps here a lot).
Comment actions Permalink

Hi Bazzik,

As you told, the </script> was wrong. I am not used to IDE's for php development and did not take care the code coloring stopped right where you metioned (line 69).

And as you mentioned all the {php} code was not my own. Right now the .tpl has been cleaned out of php code and that is what have improved radically the {} speed typing.

Anyway I've tried to recreate the previous slow scenario with the first version of the .tpl and now it hast only a 2 seconds delay when typing the first "{". Not sure what has changed.
Perhaps phpstorm reindexed once the {php} was cleaned out?

Thank you very much for you help!

Next time I'll try to take care about the color's changes.

P.S. I am really happy with Phpstorm. It is lightweight, powerful and plenty of features. It will be probably my best investment as developer.


Please sign in to leave a comment.