简体   繁体   中英

Add comma to JavaScript element on completion in PhpStorm IDE

I like my workflow to be streamlined and PhpStorm really helps me with this.

When I am creating an array in a php code template I can use shift + + to Complete the Current Statement

$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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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