簡體   English   中英

Visual Studio Code正在自動格式化具有標記的js文件

[英]Visual Studio Code is auto formatting my js file that has markup

我最近升級了Visual Studio代碼版本1.33.0,並且在保存文件時遇到問題,因為在保存文檔時它們會保持格式。

我瀏覽了更新-https: //code.visualstudio.com/updates/v1_33,並在settings.json文件中打開了javascript和javascriptreact語言。

settings.json文件

{
  "window.zoomLevel": 0,
  "files.associations": {
    "*.scss": "scss"
  },
  "mssql.connections": [
    {
      "server": "localhost",
      "database": "",
      "authenticationType": "SqlLogin",
      "user": "SA",
      "password": "",
      "emptyPasswordInput": false,
      "savePassword": true,
      "profileName": "localhost profile"
    }
  ],
  "javascript.implicitProjectConfig.experimentalDecorators": false,
  "editor.tabSize": 2,
  "php.validate.enable": false,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "workbench.startupEditor": "none",
  "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
  "editor.formatOnSave": false,
  "[javascript]": {
      "editor.formatOnSave": false,
      "editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
    "editor.formatOnSave": false,
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
}

沒關系,它會忽略這些首選項,並將其自動格式化為VSC的自動默認格式。 我正在將.js文件與react一起使用,並且無法切換rsx。 謝謝

VSC中共有3級設置(用戶級,工作區級,全局)。 檢查是否所有格式都為false。 如果仍然使您的代碼縮進,請在您的項目中創建一個.editorconfig文件,並在其中提及您的設置。 它在VSC設置中具有最高的首選項,並將覆蓋其他所有設置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM