VSCode格式化js不換行(格式化js時候{}中內容不自動換行)


  1 {
  2   //設置文字大小
  3   "editor.fontSize": 18,
  4   //設置文字行高
  5   "editor.lineHeight": 24,
  6   //開啟行數提示
  7   "editor.lineNumbers": "on",
  8   // 在輸入時顯示含有參數文檔和類型信息的小面板。
  9   "editor.parameterHints.enabled": true,
 10   // 調整窗口的縮放級別
 11   "window.zoomLevel": 0,
 12   // 文件目錄
 13   // "workbench.iconTheme": "vscode-icons",
 14   // 設置字體
 15   "editor.fontFamily": "'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'",
 16   // 自動換行
 17   "editor.wordWrap": "on",
 18   // 自定義vscode面板顏色
 19   "workbench.colorCustomizations": {
 20     // "tab.activeBackground": "#253046", // 活動選項卡的背景色
 21     // "activityBar.background": "#253046", //活動欄背景色
 22     // "sideBar.background": "#253046", //側邊欄背景色
 23     // "activityBar.foreground": "#23f8c8", //活動欄前景色(例如用於圖標)
 24     "editor.background": "#292a2c" //編輯器背景顏色
 25   },
 26   // vscode默認啟用了根據文件類型自動設置tabsize的選項
 27   "editor.detectIndentation": false,
 28   // 重新設定tabsize
 29   "editor.tabSize": 2,
 30   // #每次保存的時候自動格式化
 31   "editor.formatOnSave": true,
 32   //  #讓函數(名)和后面的括號之間加個空格
 33   "javascript.format.insertSpaceBeforeFunctionParenthesis": false,
 34   // #這個按用戶自身習慣選擇
 35   "vetur.format.defaultFormatter.html": "js-beautify-html",
 36   // #讓vue中的js按編輯器自帶的ts格式進行格式化 
 37   "vetur.format.defaultFormatter.js": "vscode-typescript",
 38   // 保存時運行的代碼ESLint操作類型。
 39   "editor.codeActionsOnSave": {
 40     "source.fixAll.eslint": true
 41   },
 42   // 添加emmet支持vue文件
 43   "emmet.includeLanguages": {
 44     "wxml": "html",
 45     "vue": "html"
 46   },
 47   // 兩個選擇器中是否換行
 48   "minapp-vscode.disableAutoConfig": true,
 49   //快速預覽(右側)
 50   "editor.minimap.enabled": true,
 51   // tab 代碼補全
 52   "files.associations": {
 53     "*.wpy": "vue",
 54     "*.vue": "vue",
 55     "*.cjson": "jsonc",
 56     "*.wxss": "css",
 57     "*.wxs": "javascript"
 58   },
 59   // 用來配置如何使用ESLint CLI引擎API啟動ESLint。 默認為空選項
 60   "eslint.options": {
 61     "extensions": [
 62       ".js",
 63       ".vue"
 64     ]
 65   },
 66   // 在onSave還是onType時執行linter。默認為onType。
 67   "eslint.run": "onSave",
 68   // 啟用ESLint作為已驗證文件的格式化程序。
 69   "eslint.format.enable": true,
 70   // 語言標識符的數組,為此ESLint擴展應被激活,並應嘗試驗證文件。
 71   "eslint.probe": [
 72     "javascript",
 73     "javascriptreact",
 74     "vue-html",
 75     "vue",
 76     "html"
 77   ],
 78   //關閉rg.exe進程 用cnpm導致會出現rg.exe占用內存很高
 79   "search.followSymlinks": false,
 80   // 給js-beautify-html設置屬性隔斷
 81   "vetur.format.defaultFormatterOptions": {
 82     "js-beautify-html": {
 83       "wrap_attributes": "aligned-multiple",
 84       "wrap_line_length": 500,
 85       "end_with_newline": false
 86     },
 87     "prettyhtml": {
 88       "printWidth": 500,
 89       "singleQuote": false,
 90       "wrapAttributes": false,
 91       "sortAttributes": false
 92     },
 93     "prettier": {
 94       "semi": false,
 95       "singleQuote": true
 96     }
 97   },
 98   // style默認偏移一個indent
 99   "vetur.format.styleInitialIndent": true,
100   // 定義匿名函數的函數關鍵字后面的空格處理。
101   "javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,
102   // 定義函數參數括號前的空格處理方式。
103   "typescript.format.insertSpaceBeforeFunctionParenthesis": true,
104   // 新版本消息
105   "vsicons.dontShowNewVersionMessage": true,
106   // 控制資源管理器是否在把文件刪除到廢紙簍時進行確認。
107   "explorer.confirmDelete": false,
108   // 使用eslint-plugin-vue驗證<template>中的vue-html
109   "vetur.validation.template": false,
110   // 格式化js時候{}中內容不自動換行
111   "beautify.config": {
112     "brace_style": "collapse,preserve-inline"
113   },
114   "beautify.language": {
115     "js": {
116       "type": [
117         "javascript",
118         "json",
119         "jsonc"
120       ],
121       "filename": [
122         ".jshintrc",
123         ".jsbeautifyrc"
124       ]
125     },
126     "css": [
127       "css",
128       "less",
129       "scss"
130     ],
131     "html": [
132       "htm",
133       "html"
134     ]
135   },
136   "terminal.integrated.confirmOnExit": true,
137   "terminal.integrated.copyOnSelection": true,
138   "terminal.integrated.cursorBlinking": true,
139   "json.trace.server": "messages",
140   "sshfs.configpaths": [],161   "javascript.format.placeOpenBraceOnNewLineForFunctions": true,
162   "javascript.implicitProjectConfig.checkJs": true,
163   "javascript.implicitProjectConfig.experimentalDecorators": true,165   "editor.formatOnPaste": true,
166   "editor.formatOnType": true,
167   // 指定用在工作台中的顏色主題。
168   // "workbench.colorTheme": "One Dark Pro"
169 }

 

{
   //設置文字大小
   "editor.fontSize"18,
   //設置文字行高
   "editor.lineHeight"24,
   //開啟行數提示
   "editor.lineNumbers""on",
   // 在輸入時顯示含有參數文檔和類型信息的小面板。
   "editor.parameterHints.enabled"true,
   // 調整窗口的縮放級別
   "window.zoomLevel"0,
   // 文件目錄
   // "workbench.iconTheme": "vscode-icons",
   // 設置字體
   "editor.fontFamily""'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'",
   // 自動換行
   "editor.wordWrap""on",
   // 自定義vscode面板顏色
   "workbench.colorCustomizations": {
     // "tab.activeBackground": "#253046", // 活動選項卡的背景色
     // "activityBar.background": "#253046", //活動欄背景色
     // "sideBar.background": "#253046", //側邊欄背景色
     // "activityBar.foreground": "#23f8c8", //活動欄前景色(例如用於圖標)
     "editor.background""#292a2c"  //編輯器背景顏色
  },
   // vscode默認啟用了根據文件類型自動設置tabsize的選項
   "editor.detectIndentation"false,
   // 重新設定tabsize
   "editor.tabSize"2,
   // #每次保存的時候自動格式化
   "editor.formatOnSave"true,
   //  #讓函數(名)和后面的括號之間加個空格
   "javascript.format.insertSpaceBeforeFunctionParenthesis"false,
   // #這個按用戶自身習慣選擇
   "vetur.format.defaultFormatter.html""js-beautify-html",
   // #讓vue中的js按編輯器自帶的ts格式進行格式化 
   "vetur.format.defaultFormatter.js""vscode-typescript",
   // 保存時運行的代碼ESLint操作類型。
   "editor.codeActionsOnSave": {
     "source.fixAll.eslint"true
  },
   // 添加emmet支持vue文件
   "emmet.includeLanguages": {
     "wxml""html",
     "vue""html"
  },
   // 兩個選擇器中是否換行
   "minapp-vscode.disableAutoConfig"true,
   //快速預覽(右側)
   "editor.minimap.enabled"true,
   // tab 代碼補全
   "files.associations": {
     "*.wpy""vue",
     "*.vue""vue",
     "*.cjson""jsonc",
     "*.wxss""css",
     "*.wxs""javascript"
  },
   // 用來配置如何使用ESLint CLI引擎API啟動ESLint。 默認為空選項
   "eslint.options": {
     "extensions": [
       ".js",
       ".vue"
    ]
  },
   // 在onSave還是onType時執行linter。默認為onType。
   "eslint.run""onSave",
   // 啟用ESLint作為已驗證文件的格式化程序。
   "eslint.format.enable"true,
   // 語言標識符的數組,為此ESLint擴展應被激活,並應嘗試驗證文件。
   "eslint.probe": [
     "javascript",
     "javascriptreact",
     "vue-html",
     "vue",
     "html"
  ],
   //關閉rg.exe進程 用cnpm導致會出現rg.exe占用內存很高
   "search.followSymlinks"false,
   // 給js-beautify-html設置屬性隔斷
   "vetur.format.defaultFormatterOptions": {
     "js-beautify-html": {
       "wrap_attributes""aligned-multiple",
       "wrap_line_length"500,
       "end_with_newline"false
    },
     "prettyhtml": {
       "printWidth"500,
       "singleQuote"false,
       "wrapAttributes"false,
       "sortAttributes"false
    },
     "prettier": {
       "semi"false,
       "singleQuote"true
    }
  },
   // style默認偏移一個indent
   "vetur.format.styleInitialIndent"true,
   // 定義匿名函數的函數關鍵字后面的空格處理。
   "javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions"true,
   // 定義函數參數括號前的空格處理方式。
   "typescript.format.insertSpaceBeforeFunctionParenthesis"true,
   // 新版本消息
   "vsicons.dontShowNewVersionMessage"true,
   // 控制資源管理器是否在把文件刪除到廢紙簍時進行確認。
   "explorer.confirmDelete"false,
   // 使用eslint-plugin-vue驗證<template>中的vue-html
   "vetur.validation.template"false,
   // 格式化js時候{}中內容不自動換行
   "beautify.config": {
     "brace_style""collapse,preserve-inline"
  },
   "beautify.language": {
     "js": {
       "type": [
         "javascript",
         "json",
         "jsonc"
      ],
       "filename": [
         ".jshintrc",
         ".jsbeautifyrc"
      ]
    },
     "css": [
       "css",
       "less",
       "scss"
    ],
     "html": [
       "htm",
       "html"
    ]
  },
   "terminal.integrated.confirmOnExit"true,
   "terminal.integrated.copyOnSelection"true,
   "terminal.integrated.cursorBlinking"true,
   "json.trace.server""messages",
   "sshfs.configpaths": [],
   "sshfs.configs": [
    {
       "agent""//./pipe/openssh-ssh-agent",
       "host""192.9.200.247",
       "name""192.9.200.247",
       "password""gjj_v4pe",
       "port"22,
       "root""/tmp",
       "username""administrator"
    },
    {
       "agent""//./pipe/openssh-ssh-agent",
       "host""192.9.200.222",
       "name""192.9.200.222",
       "password""lingroot",
       "port"22,
       "root""/home",
       "username""root"
    }
  ],
   "javascript.format.placeOpenBraceOnNewLineForFunctions"true,
   "javascript.implicitProjectConfig.checkJs"true,
   "javascript.implicitProjectConfig.experimentalDecorators"true,
   "terminal.integrated.shell.windows""C: \\ Windows \\ System32 \\ WindowsPowerShell \\ v1.0 \\ powershell.exe",
   "editor.formatOnPaste"true,
   "editor.formatOnType"true,
   // 指定用在工作台中的顏色主題。
   // "workbench.colorTheme": "One Dark Pro"
}


免責聲明!

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



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