That's quite often for me that I need to change my single-line JS object to a multi-line one. Such as:
var obj = { prop1: 'abc', prop2: 123, prop3: 'something else' }
| |
v v
var obj = {
prop1: 'abc',
prop2: 123,
prop3: 'something else'
}
Is there some shortcut for doing such a thing in VSCode? Or is there some way to create such a shortcut?
You could use splitline plugin. See plugin here: https://marketplace.visualstudio.com/items?itemName=chenzhe.split-line
Will solve your needs (easily in visual studio code)
esbenp.prettier-vscode
https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
You can make it format on save, which is very nice.
正确的方法是设置 ESLint(或更漂亮的)规则,VSCode 会在保存时自动为您执行此操作。
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.