1. 程式人生 > 其它 >VS code 程式碼自動格式化3(vue2 程式碼自動格式化)

VS code 程式碼自動格式化3(vue2 程式碼自動格式化)

vue2 程式碼自動格式化

{
  // "git.enableSmartCommit": true,
  // "git.confirmSync": false,
  "diffEditor.ignoreTrimWhitespace": false,
  "files.autoSave": "afterDelay",
  "files.associations": {
    "*.vue": "vue",
    "*.wpy": "vue",
    "*.wxml": "wxml",
    "*.cjson": "jsonc",
    "*.wxss": "css",
    "*.wxs": "javascript",
    "*.html": "html"
  },
  //通過介面能夠修改的配置
  "eslint.run": "onSave",
  "eslint.format.enable": true,
  "eslint.migration.2_x": "off",
  "eslint.enable": true, //是否開啟vscode的eslint
  "eslint.alwaysShowStatus": true,
  "eslint.options": {
    //指定vscode的eslint所處理的檔案的字尾
    "extensions": [".js", ".vue", ".ts", ".tsx"]
  },
  // 配置 ESLint 檢查的檔案型別 autoFix預設開啟,只需輸入字串陣列即可
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "vue-html",
    "html",
    "vue"
    //{"language": "vue","autoFix": true}
  ],
  "editor.tabSize": 2,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  //安裝live Server外掛
  "liveServer.settings.donotShowInfoMsg": true,
  "liveServer.settings.donotVerifyTags": true,
  "liveServer.settings.NoBrowser": true,
  "prettier.semi": false, //  #去掉程式碼結尾的分號
  "prettier.singleQuote": true, //  #使用單引號替代雙引號
  "prettier.eslintIntegration": true,
  "svn.enableProposedApi": "product",
  // "search.followSymlinks": false,
  "typescript.check.npmIsInstalled": false,
  "[vue]": {
    "editor.defaultFormatter": "dbaeumer.vscode-eslint"
  },
  "[html]": {
    "editor.defaultFormatter": "vscode.html-language-features"
  },
  "[css]": {
    "editor.defaultFormatter": "HookyQR.beautify"
  },
  "[scss]": {
    "editor.defaultFormatter": "HookyQR.beautify"
  },
  "[jsonc]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascript]": {
    "editor.defaultFormatter": "HookyQR.beautify"
  },
  "[typescript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "json.schemas": [
    {
      "fileMatch": ["/myfile"],
      "url": "schemaURL"
    }
  ],
  "[git-commit]": {
    "editor.rulers": [72],
    "workbench.editor.restoreViewState": false
  },
  "git.autofetch": true,
  // 格式化stylus, 需安裝Manta's Stylus Supremacy外掛
  "stylusSupremacy.insertColons": false, // 是否插入冒號
  "stylusSupremacy.insertSemicolons": false, // 是否插入分好
  "stylusSupremacy.insertBraces": false, // 是否插入大括號
  "stylusSupremacy.insertNewLineAroundImports": false, // import之後是否換行
  "stylusSupremacy.insertNewLineAroundBlocks": false,

  "beautify.language": {
    "js": {
      "type": ["javascript", "json", "jsonc"],
      "filename": [".jshintrc", ".jsbeautifyrc"]
    },
    "css": ["css", "less", "scss"],
    "html": ["htm", "html"]
  },
  "vsicons.dontShowNewVersionMessage": true,
  "guides.enabled": false,
  "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
  "react-native-tools.showUserTips": false, // 兩個選擇器中是否換行
  // vscode預設啟用了根據檔案型別自動設定tabsize的選項
  "editor.detectIndentation": false,
  // "editor.fontLigatures": false, // 是否啟用字型連字
  "editor.fontLigatures": null, // 是否啟用字型連字
  "editor.suggestSelection": "first",
  "editor.renderControlCharacters": true,
  "editor.multiCursorModifier": "ctrlCmd", // 兩個選擇器中是否換行
  // "editor.snippetSuggestions": "none",
  // 控制鍵入觸發器字元時是否應自動顯示建議
  "editor.suggestOnTriggerCharacters": false,
  // 控制是否根據文件中的文字計算自動完成列表。
  "editor.wordBasedSuggestions": false,
  "editor.suggest.showFunctions": false,
  "editor.suggest.showInterfaces": false,
  "editor.acceptSuggestionOnCommitCharacter": false,
  // "editor.quickSuggestions": null, //是否開啟.vue專案,標準格式化規範.eslintrc.js
  "editor.quickSuggestions": {
    "strings": false,
  },
  "emmet.includeLanguages": {
    "wxml": "html"
  },
  "minapp-vscode.disableAutoConfig": true,
  //  #讓函式(名)和後面的括號之間加個空格
  "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
  // #讓vue中的js按編輯器自帶的ts格式進行格式化
  "vetur.format.defaultFormatter.js": "vscode-typescript",
  "vetur.format.defaultFormatter.html": "js-beautify-html",
  //一定要在vutur.defaultFormatterOptions引數中設定,單獨修改prettier擴充套件的設定是無法解決這個問題的,因為perttier預設忽略了vue檔案(事實上從忽略列表移除vue也不能解決這個問題)
  "vetur.format.defaultFormatterOptions": {
    "prettier": {
      "semi": false, // 格式化不加分號
      "singleQuote": true, // 格式化以單引號為主
      "trailingComma": "none" //是否最後一句話使用逗哈來結尾
    },
    "js-beautify-html": {
      // force-aligned | force-expand-multiline
      "wrap_attributes": "force-aligned"
    },
    "prettyhtml": {
      "printWidth": 100,
      "singleQuote": false,
      "wrapAttributes": false,
      "sortAttributes": true
    }
  },
  "workbench.editor.showTabs": true,
  // 別名路徑跳轉外掛
  "alias-skip.mappings": {
    "@": "/src", // 預設只有`@`對映,對映到`/src`,你可以新增更多對映,對映路徑必須以`/`開頭
    // ...更多對映關係
    "~@/": "/src",
    "views": "/src/views",
    "assets": "/src/assets",
    "network": "/src/network",
    "common": "/src/common"
  },
  // "alias-skip.allowedsuffix": ["js","vue","jsx","ts"],  // 預設有這四項
  "alias-skip.rootpath": "package.json",
  "workbench.iconTheme": "vscode-icons",
  "svn.path": "D://Software//TortoiseSVN//bin",
  "editor.formatOnPaste": true,
  "bracketPairColorizer.depreciation-notice": false,
  "tabnine.experimentalAutoImports": true,
  "security.workspace.trust.untrustedFiles": "open",
  "bracket-pair-colorizer-2.depreciation-notice": false,
  "github.copilot.enable": {
    "*": true,
    "yaml": false,
    "plaintext": true,
    "markdown": false
  },
  "alignment.surroundSpace": {
  
    "colon": [
      0,
      1
    ],
    "assignment": [
      1,
      1
    ],
    "arrow": [
      1,
      1
    ],
    "comment": 2
  },
  "http.proxyAuthorization": null,
  "auto-close-tag.excludedTags": [
  
    "area",
    "base",
    "br",
    "col",
    "command",
    "embed",
    "hr",
    "img",
    "input",
    "keygen",
    "link",
    "meta",
    "param",
    "source",
    "track",
    "wbr"
  ],
}