Visual Studio Code代碼格式化Vue文件設置快捷鍵ctrl+alt+l


 

【vscode中使用beautify插件格式化vue文件(自定義快捷鍵)】https://blog.csdn.net/jiandan1127/article/details/85958965

 


 

C:\Users\qinmt\AppData\Roaming\Code\User\settings.json

{
    "files.autoSave": "afterDelay",             
    "editor.fontSize": 15,               
    "vetur.format.defaultFormatter.html": "js-beautify-html",
    "files.associations": {
        "*.wxml": "wxml",
        "*.vue": "vue-html"
    },
    "explorer.confirmDelete": false,
    "workbench.colorTheme": "Visual Studio Dark",
    "svn.enableProposedApi": "product",
    "editor.quickSuggestions": {
        "strings": true
    },
    "git.autofetch": true,
    "[vue-html]": {
        
    },
    "beautify.language": {
        "js": {
        "type": [
            "javascript",
            "json"
        ],
        "filename": [
            ".jshintrc",
            ".jsbeautify"
            ]
        },
        "css": [
            "css",
            "scss"
        ],
        "html": [
            "htm",
            "html",
            "vue"//在這里加上vue
        ]
    }
}

將鍵綁定放在此文件中以覆蓋默認值

C:\Users\Kegog\AppData\Roaming\Code\User\keybindings.json

[
{
"key": "ctrl+alt+l", // 自己定鍵位
"command": "HookyQR.beautify",
"when": "editorFocus"
}
]

  

.jsbeautifyrc

{
    "brace_style": "none,preserve-inline",
    "indent_size": 4,
    "indent_char": " ",
    "inline": ["a-input"],
    "jslint_happy": false,
    "unformatted": ["v-decorator"],
    "css": {
        "indent_size": 2
    }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM