Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to align text to specific character in phpstorm or webstorm?

I have this text

$test1 = 'testing1'; $test1test1 = 'testing1'; $test1test1test1 = 'testing1'; $test1 = 'testing1'; 

and I would like to align it like this, using tabs,

$test1           = 'testing1'; $test1test1      = 'testing1'; $test1test1test1 = 'testing1'; $test1           = 'testing1'; 

is there a way of doing this in phpstorm or webstorm ?

like image 490
Patrioticcow Avatar asked Jun 24 '13 17:06

Patrioticcow


People also ask

How do you search on WebStorm?

Press Ctrl+Shift+F or select Edit | Find | Find in Files from the main menu. In the search field, type your search string. Alternatively, in the editor, highlight the string you want to find and press Ctrl+Shift+F . WebStorm places the highlighted string into the search field.


2 Answers

Cmd+Alt+L (in Mac) or Ctrl+Alt+L (Win) and PHP Storm will format code depends of your Code style in Settings. TO set this code style go: File -> Settings -> Code style -> PHP(choose here your language) -> Other -> Align key-value pair - mark as checked. And then press Reformat code (Ctrl+Alt+L) and voila. You will get code, styled you write above.

like image 113
LIAL Avatar answered Oct 01 '22 08:10

LIAL


For me in PhpStorm 8.0.2 I found it here:

Settings -> Editor -> Code Style -> PHP -> Wrapping and Braces -> Align consecutive assignments

like image 31
Sam Avatar answered Oct 01 '22 07:10

Sam