简体   繁体   English

在PhpStorm IDE中在完成时将逗号添加到JavaScript元素

[英]Add comma to JavaScript element on completion in PhpStorm IDE

I like my workflow to be streamlined and PhpStorm really helps me with this. 我希望简化工作流程,而PhpStorm确实可以帮助我。

When I am creating an array in a php code template I can use shift + + to Complete the Current Statement 当我在php代码模板中创建数组时,可以使用shift + + 完成当前语句

$array = [
    'key'**TextCusrorHere** => 'value'
    'anotherkey' => 'anothervalue',
];

When I invoke the Complete the Current Statement command where the text cursor is, the following happens: 当我在文本光标所在的位置调用完成当前语句命令时,将发生以下情况:

$array = [
    'key' => 'value', // note the comma gets added to the end of the line 
    **TextCursorHere**
    'anotherKey' => 'anotherValue',
];

Now my problem is that the same functionality does not occur when editing in a JavaScript file. 现在我的问题是,在JavaScript文件中进行编辑时,不会出现相同的功能。

For Example: 例如:

var object = {
    key**TextCursorHere**: "value"
    anotherKey: "anotherValue",
};

When I invoke the Complete the Current Statement command where the text cursor is, the following happens: 当我在文本光标所在的位置调用完成当前语句命令时,将发生以下情况:

var object = {
    key: "value" // note that the comma DOES NOT get added
    **TextCursorHere**
    anotherKey: "anotherValue",
};

Please note that I am not referring to trailing commas on the last element of an array or last property of an object. 请注意,我不是在数组的最后一个元素或对象的最后一个属性上尾随逗号。 I can post my configuration if that helps. 如果有帮助,我可以发布我的配置。

目前无法使用,请投票给WEB-13348

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

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