PHPStorm 9 autoformat breaks javascript ES6 Template literals

已回答

Typing an end curly brace fires off PHPStorm auto formatting, which can break javascript ES6 Template literals. Is there a fix or work around for this?

Typing the closing curly brace on the else if below:

} else {
$("#system-search-fields").empty();
$("#system-search-fields").append(`
<li id=''>
<span class='ssf-err'>Unknown error</span>
</li>
`);

<type closing curly brace here>

Gets reformatted to:

} else {
$("#system-search-fields").empty();
$("#system-search-fields").append(`
<
li
id = '' >
< span
class
= 'ssf-err' > Unknown
error < / span >
< / li >
`)
;
}

and breaks the html

 

0
Avatar
Permanently deleted user

Hello,

Unfortunately I cannot reproduce this with PhpStorm 2016.2.

Could you please download it from https://www.jetbrains.com/phpstorm/download/ and check if the issue you described can be reproduced there?

0
Avatar
Permanently deleted user

Unless it is free I'm not really interested in wether or not it works inPhpStorm 2016.2. PHP Storm 9 is not aware of template literals. I would like to know if there is a fix, or work around or something I can turn off to prevent this from happening in PHP Storm 9. 

0

I was able to reproduce it in v9. Even though I couldn't find a relevant issue, it is indeed fixed in the following releases.
As we do not backport fixes, the only option you have is to upgrade, unfortunately. Sorry.

0
Avatar
Permanently deleted user

I unchecked the option Reformat block on typing '}' in Preferences > Editor > General > Smart Keys

That seems to have worked for now. 

1

请先登录再写评论。