admin管理员组文章数量:1391805
My javascript code is formatted like this and I'm not fortable 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.
My javascript code is formatted like this and I'm not fortable 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.
Share Improve this question edited Mar 25, 2020 at 11:08 Bahman Parsa Manesh asked Oct 14, 2019 at 8:28 Bahman Parsa ManeshBahman Parsa Manesh 2,3683 gold badges18 silver badges36 bronze badges 7- Prettier - Code formatter - Visual Studio Marketplace? – Praveen Kumar Purushothaman Commented Oct 14, 2019 at 8:29
- Prettier exactly change one-line parameters to one parameter per line. Is there any setting to change this? – Bahman Parsa Manesh Commented Oct 14, 2019 at 8:36
-
1
You can use
"printWidth": whateverCharacterLengthYouWant
in your.prettierrc
file. After the given character length(plus some other conditions) it will e on next line.By default it is set to80
– Debajit Majumder Commented Oct 14, 2019 at 8:49 -
1
You can add
.prettierrc
at the root of your project code and you should mit that file so that everyone working on that project follow the same code styling/formatting..prettierrc
is a simple JSON file. – Debajit Majumder Commented Oct 14, 2019 at 9:31 - 1 Happy to help you. Seems like @PraveenKumarPurushothaman just answered the same what I have mentioned here in ment. You can accept his answer and upvote my ments. – Debajit Majumder Commented Oct 14, 2019 at 10:13
1 Answer
Reset to default 8The 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.
本文标签: javascriptHow to format all parameters of a function in one line in Visual Studio CodeStack Overflow
版权声明:本文标题:javascript - How to format all parameters of a function in one line in Visual Studio Code - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744760877a2623748.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论