Looking for a VSCode extension or setting to apply formatting rules to the =>
operator in an array to assist in readability.
In the examples below, I updated an existing array and the =>
alignment is disrupted.
Is it possible to highlight the changed section and apply a formatting rule to the PHP?
Original array with => operator lined up neatly
$this->settings = [
'title' => [
'type' => 'text',
'std' => '',
'label' => 'Title:',
],
'description' => [
'type' => 'text',
'std' => '',
'label' => 'Description',
],
'number_of_posts' => [
'type' => 'number',
'std' => '3',
'label' => 'Number of posts to display',
'min' => '1',
'max' => '20',
'step' => 1,
],
]
Udpated array with => operator out of alignment
$this->settings = [
'title' => [
'type' => 'text',
'default_value' => '',
'label' => 'Title:',
],
'description' => [
'type' => 'text',
'default_value' => '',
'label' => 'Description',
],
'number_of_posts' => [
'type' => 'number',
'default_value' => '3',
'label' => 'Number of posts to display',
'min' => '1',
'max' => '20',
'step' => 1,
],
];
Array - indiviudally moved => operators into alignment
$this->settings = [
'title' => [
'type' => 'text',
'default_value' => '',
'label' => 'Title:',
],
'description' => [
'type' => 'text',
'default_value' => '',
'label' => 'Description',
],
'number_of_posts' => [
'type' => 'number',
'default_value' => '3',
'label' => 'Number of posts to display',
'min' => '1',
'max' => '20',
'step' => 1,
],
];