Leo*_*oue 4 typescript visual-studio-code angular
我正在 Visual Studio Code 上开发一个 Angular 项目,并且在 Typescript 文件上遇到一个烦人的格式文档设置,它将参数中断为新行:
格式化之前(alt+shift+f):
this.opportunityId = this.route.snapshot.paramMap.get('opportunityid');
this.opportunityTermVendorId = this.route.snapshot.paramMap.get('vendorid');
this.opportunityTermVendorAssetId = this.route.snapshot.paramMap.get('assetid');
this.opportunityTermCollateralId = this.route.snapshot.paramMap.get('collateralid');
Run Code Online (Sandbox Code Playgroud)
格式化后(alt+shift+f):
this.opportunityId = this.route.snapshot.paramMap.get('opportunityid');
this.opportunityTermVendorId = this.route.snapshot.paramMap.get('vendorid');
this.opportunityTermVendorAssetId = this.route.snapshot.paramMap.get(
'assetid'
);
this.opportunityTermCollateralId = this.route.snapshot.paramMap.get(
'collateralid'
);
Run Code Online (Sandbox Code Playgroud)
我已关闭自动换行,但我仍然尝试将其设置为更大的自动换行列值。查看我当前的设置覆盖
{
"git.confirmSync": false,
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"workbench.iconTheme": "material-icon-theme",
"editor.formatOnSave": true,
"prettier.singleQuote": true,
"editor.wordWrapColumn": 180
}
Run Code Online (Sandbox Code Playgroud)
对我来说"prettier.printWidth": 180没有用,但事实证明最新版本的 prettier 在每个属性的开头没有“prettier”部分。
所以.prettierrc我现在已经"printWidth": 180解决了这个问题。
| 归档时间: |
|
| 查看次数: |
4384 次 |
| 最近记录: |