简体   繁体   English

PhpStorm - 用于破坏ES6模板字符串的Backticks`

[英]PhpStorm - Backticks ` for ES6 template strings broken

When using backticks in a JavaScript file such as : 在JavaScript文件中使用反引号时,例如:

var name = 'Tom';
var greeting = `hello my name is ${name}`;

PhpStorm does all sorts of weird auto-formatting that breaks the file. PhpStorm执行各种奇怪的自动格式化打破文件。

Backticks randomly appear or disappear, commenting the rest of the file. 反引号随机出现或消失,对文件的其余部分进行注释。 I've disabled the 'insert pair quotes' option in Settings but the problem still persists. 我在“设置”中禁用了“插入对引号”选项,但问题仍然存在。

Is there a way to disable auto-formatting for backticks in PhpStorm version 2016.1.2? 有没有办法在PhpStorm版本2016.1.2中禁用反引号的自动格式化?

I have the same Problem with template strings. 我对模板字符串有同样的问题。 In the example, I added a backtick and it disappears when moving the cursor. 在这个例子中,我添加了一个反引号,它在移动光标时消失了。 Not if you use the mouse. 如果你使用鼠标不是。 example gif 例如gif

My current workaround is to use normal concatenation and let PhpStorm convert it by clicking on the lightbulb. 我目前的解决方法是使用常规连接, 让PhpStorm通过单击灯泡进行转换

I temporarily switched to using Sublime Text because my Macbook Air's 4 GB of RAM were not enough for Phpstorm. 我暂时转向使用Sublime Text,因为我的Macbook Air的4 GB RAM对于Phpstorm来说还不够。

The backtick problem still occurs with Sublime Text. Sublime Text仍会出现反引号问题。

This makes me think that the problem is more related to OS X than Phpstorm. 这让我觉得问题与OS X的关系比Phpstorm更多。

Also the developer from Jetbrains was not able to reproduce the problem when I posted a bug there. 当我在那里发布一个bug时,Jetbrains的开发人员也无法重现这个问题。

Because of the Macbook Pro 2016 debacle, I switched back to windows and the problem does not occur anymore for me. 由于Macbook Pro 2016的崩溃,我切换回窗口,问题不再发生在我身上。 If anyone has a better answer I will update this. 如果有人有更好的答案,我会更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM