How to set up code refactoring, in particular for variables, in the sublime editors and JetBrains products?

JS example:

var name = 'a', secondName = 'b'; var obj = { name: 'a', secondName: 'b' } 

PHP example

 public $name = 'a'; public $secondName = 'b'; 

And after running the code refactoring:

JS example:

 var name = 'a', secondName = 'b'; var obj = { name : 'a', secondName: 'b' } 

PHP example

 public $name = 'a'; public $secondName = 'b'; 
  • Code refactoring is fundamentally different than the placement of spaces. What you want in JetBrains is called the Reformat Code. Customizable: File -> Settings .. -> Editor -> Code Style -> [programming language]. Only here what you want to specify there is unlikely to succeed. I don’t know about Sublime - pavlofff

2 answers 2

There are quite a few plugins for IDEA, for example, the Eclipse Code Formatter . In addition, there is the ability to call external utilities that format the source code. Up to a separate plug-in , which will replace the external formatter built-in. So the choice is great: look for the one that can do the right thing and connect.

    for Sublime there is a Code Alignment plugin