have a problem with prettier extension in VS Code, When I write this:
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.
You could however set a very short printWidth
or put // prettier-ignore
comment above your code.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.