[英]Is there a config in prettier to keep line breaks?
have a problem with prettier extension in VS Code, When I write this:在 VS Code 中使用更漂亮的扩展有问题,当我写这个时:
const result = await pool
.request()
.query('select NumberPlate, ID, TimeStamp from RESULTS order by ID');
and save the file, it turns into a single line like this:并保存文件,它变成了这样的一行:
const result = await pool.request().query('select NumberPlate, ID, TimeStamp from RESULTS order by ID');
with the following config in prettier:使用更漂亮的以下配置:
{
"git.confirmSync": false,
"editor.minimap.enabled": false,
"window.zoomLevel": 0,
"liveServer.settings.donotShowInfoMsg": true,
"workbench.startupEditor": "newUntitledFile",
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
"editor.formatOnSave": true,
"prettier.printWidth": 200,
"prettier.singleQuote": true,
"prettier.arrowParens": "always",
"editor.tabSize": 2,
"editor.tabCompletion": "on"
}
Is there a way to avoid this from happening?有没有办法避免这种情况发生?
Thanks!谢谢!
According to this Github issue and looking at the doc, it doesn't seem to be possible to configure it to keep line breaks.根据this Github issue并查看文档,似乎无法将其配置为保持换行符。
You could however set a very short printWidth
or put // prettier-ignore
comment above your code.但是,您可以设置一个非常短的
printWidth
或在代码上方放置// prettier-ignore
printWidth
// prettier-ignore
注释。
Did not find a configuration.没有找到配置。 As a hack you might want to include a comment on the first line to break:
作为黑客,您可能希望在要中断的第一行中包含注释:
return ternaryExpression //
? trueResult
: falseResult;
您可以在此问题上表示支持-https: //github.com/prettier/prettier/issues/2550
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.