Bahman Parsa Manesh
Bahman Parsa Manesh

Reputation: 2370

How to format all parameters of a function in one line in Visual Studio Code

My javascript code is formatted like this and I'm not comfortable with this :

function(
    req,
    req.session,
    amount,
    offerCode,
    userChoice,
    referenceNo,
    transactionId,
    function (err, res) {
        ...
}

I prefer to change it like this :

function( req, req.session, amount, offerCode, userChoice, eferenceNo, transactionId, function (err, res) {
    ...
}

Is there any code-formatter to do this automatically on a huge bunch of code.

Upvotes: 2

Views: 3312

Answers (1)

Praveen Kumar Purushothaman
Praveen Kumar Purushothaman

Reputation: 167172

The best thing to use is Prettier - Code formatter in this case. Use a file called .prettierrc in your root of the folder that you put into VS Code and add the following inside it:

{
  "printWidth": 8000
}

The default is 80 in this case.

Upvotes: 8

Related Questions