如何在vscode中格式化js代码

时间:2018-05-09 03:30:25

标签: visual-studio-code vscode-settings

my settings.json

"editor.wordWrap": "off",

该设置可以在.vue文件中显示一行

但在格式化js代码

时,在.js文件中不起作用
import {
  Message
} from 'element-ui'
import {
  getLoginInfo,
  getDeviceId,
  deleteEmptyObjParam
} from 'util'

我的预期结果是

import {getLoginInfo, getDeviceId, deleteEmptyObjParam} from 'util'

我该如何配置?

我的vscode版本

1.23.0 (1.23.0)

完整settings.json

{
    "explorer.confirmDragAndDrop": true,
    "files.associations": {
        "*.vue": "vue"
    },
    "editor.wordSeparators": "`~!@#$%^&*()=+[{]}\\|;:'\",.<>/?",
    "workbench.iconTheme": "material-icon-theme",
    "vsicons.presets.jsOfficial": true,
    "vsicons.presets.tsOfficial": true,
    "window.zoomLevel": 0,
    "prettier.singleQuote": true,
    "prettier.semi": false,
    "editor.tabSize": 2,
    "vetur.format.defaultFormatter.html": "js-beautify-html",
    "vetur.format.defaultFormatterOptions": {
        "wrap_attributes": "force-aligned"
    },
    "editor.wordWrap": "off",
    "editor.formatOnPaste": false,
    "editor.formatOnSave": false,
    "editor.formatOnType": false,
    "workbench.colorTheme": "Atom One Dark",
}

0 个答案:

没有答案