请告诉我格式化/缩进功能参数的最佳/最常用的方式对象
问题描述:
我想知道StackOverflow的人群如何喜欢缩进自己的代码,你会怎么缩进/格式化下面的代码。请告诉我格式化/缩进功能参数的最佳/最常用的方式对象
this.router.navigate([
'search', {
filters: btoa(JSON.stringify({
author: uid,
byLikes: -1,
requireInteractions: true,
limit: ContentListComponent.contentPerLoad
}))}
]);
我真的找不到一个好...好看的方式来使(),[],{}匹配。
答
this.router.navigate([
'search', {
filters: btoa(JSON.stringify({
author: uid,
byLikes: -1,
requireInteractions: true,
limit: ContentListComponent.contentPerLoad
}))
}
]);
只是在新块开始时缩进。
如果您使用的崇高的文本有一个好的包JsFormat这可以让运行在一个文件,它会自动修正意图的问题(也做其他的东西)。看看这里:https://github.com/jdc0589/JsFormat
一般一个继承的块的一个电平超过在其上括号中发现行的内容。 – Bergi