Reputation: 357
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.
Upvotes: 0
Views: 476