Settings > Editor > General > Smart Keys > HTML/CSS > XML/HTML > Add quotes for attribute value on typing '=' and attribute completion

The Add quotes for attribute value on typing '=' and attribute completion setting works as expected in an HTML file, but not in a PHP file.

I have tested this behaviour on older versions (2018.2.4 and 2019.1.2) and it isn't a problem on those.

I'm currently using PhpStorm 2020.1.1...

 

... and with the setting enabled...


...it works as expected on an .html file...

...but not on a .php file (the auto-generated closing quote isn't eaten by over-typing ")...

I've literally typed...

<div id=test"

...in both cases.  Which results in this as I continue to type for the .html file...

<div id="test">|</div>

...and this for the .php file...

<div id="test">"|</div>

Clearly I could...

  • Use the backspace key to delete the unwanted extra "
  • Use the forward arrow key to skip over the auto-generated closing quote mark

However both workarounds slow me down significantly when typing code at speed.

In case this is due to an plug-in, here is the plug-ins I currently have installed...

2 comments
Comment actions Permalink

Hi there,

It works fine in PHP files (be it plain .php or Blade one).

However, it does not work in .blade.php file if you have package.json file with vue dependency (which is present in a typical Laravel project), e.g.

...
"devDependencies": {
   "vue": "^2.5.17"
}

If you remove/rename such dependency .. or delete/rename package.json file it will start working again.

Another possible solution -- disable Vue.js plugin and restart IDE.

In any case: https://youtrack.jetbrains.com/issue/WEB-43054

 

P.S. The Vue.js plugin had other issues in blade files that were fixed in 2020.1 (e.g. https://youtrack.jetbrains.com/issue/WEB-42930). Same workarounds.

1
Comment actions Permalink

Thanks Andriy, I really appreciate the quick and concise response.

I can confirm that disabling the Vue.js plug-in does resolve the problem, so I'll take that route.  I can always re-enable it just when I'm writing Vue components.

0

Please sign in to leave a comment.