Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/473.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PhpStorm IDE中完成时向JavaScript元素添加逗号_Javascript_Php_Intellij Idea_Phpstorm_Webstorm - Fatal编程技术网

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

在PhpStorm IDE中完成时向JavaScript元素添加逗号,javascript,php,intellij-idea,phpstorm,webstorm,Javascript,Php,Intellij Idea,Phpstorm,Webstorm,我喜欢我的工作流程是流线型的,PhpStorm真的帮助了我 在php代码模板中创建数组时,我可以使用shift+⌘ + ↵ 完成当前语句 调用文本光标所在的Complete the Current Statement命令时,会发生以下情况: $array = [ 'key' => 'value', // note the comma gets added to the end of the line **TextCursorHere** 'anotherKey'

我喜欢我的工作流程是流线型的,PhpStorm真的帮助了我

在php代码模板中创建数组时,我可以使用shift+⌘ + ↵ 完成当前语句

调用文本光标所在的Complete the Current Statement命令时,会发生以下情况:

$array = [
    'key' => 'value', // note the comma gets added to the end of the line 
    **TextCursorHere**
    'anotherKey' => 'anotherValue',
];
var object = {
    key: "value" // note that the comma DOES NOT get added
    **TextCursorHere**
    anotherKey: "anotherValue",
};
现在我的问题是,在JavaScript文件中编辑时不会出现相同的功能

例如:

var object = {
    key**TextCursorHere**: "value"
    anotherKey: "anotherValue",
};
调用文本光标所在的Complete the Current Statement命令时,会发生以下情况:

$array = [
    'key' => 'value', // note the comma gets added to the end of the line 
    **TextCursorHere**
    'anotherKey' => 'anotherValue',
];
var object = {
    key: "value" // note that the comma DOES NOT get added
    **TextCursorHere**
    anotherKey: "anotherValue",
};
请注意,我指的不是数组最后一个元素或对象最后一个属性上的尾随逗号。
如果有帮助的话,我可以发布我的配置。

这当前不起作用,请投票支持这当前不起作用,请投票支持这是一个怎样的问题?JS中的尾随逗号很少见。@Alexlex我更新了我的帖子,表明我指的不是尾随逗号,而是数组元素或对象属性。例如,我可能希望在数组或对象声明的开头插入元素或对象属性。这意味着PhpStorm最好添加逗号。这是一个怎样的问题?JS中的尾随逗号很少见。@Alexlex我更新了我的帖子,表明我指的不是尾随逗号,而是数组元素或对象属性。例如,我可能希望在数组或对象声明的开头插入元素或对象属性。这意味着PhpStorm最好添加逗号。