vscode編輯器自定義配置


{
    //刪除文件確認
    "explorer.confirmDelete": false,
    // 主題
    "workbench.iconTheme": "vscode-icons",
    // 小地圖
    "editor.minimap.enabled": true,
    // 主題風格One Dark Pro
    // "workbench.colorTheme": "One Dark Pro",
    //窗口大小比例
    // "window.zoomLevel": 1,
    // "extensions.autoUpdate": false,
    // 字體大小
    // "editor.fontSize": 13,
    "editor.snippetSuggestions": "top",
    "diffEditor.ignoreTrimWhitespace": true,
    // 設置格式化縮進4格
    // "prettier.tabWidth": 4,
    "vetur.format.defaultFormatter.html": "prettier",
    // "gitlens.advanced.messages": {
    //     "suppressShowKeyBindingsNotice": true
    // },
    // "gitlens.historyExplorer.enabled": true,
    // "atomKeymap.promptV3Features": true,
    "editor.multiCursorModifier": "ctrlCmd",
    //粘貼自動格式化
    "editor.formatOnPaste": false,
    //保存自動格式化
    "editor.formatOnSave": false,
    // 用來忽略工程打開的文件夾
    "files.exclude": {
        "**/.vscode": true,
        "**/.DS_Store": true,
        "**/.history":true,
        "**/nbproject":true
    },
    // 用來忽略搜索的文件夾
    "search.exclude": {
        "**/node_modules/**": true,
        "**/bower_components/**": true,
        "**/image/**": true,
        "**/*.xml": true,
        "**/.history/**":true,
        "**/nbproject/**":true,
        "**/vscode/**":true

    },
    // // 創建和更新代碼的頭部信息作者
    // "fileheader.Author": "Baldwin",
    // "fileheader.LastModifiedBy": "Baldwin",
}
 
        

以上是簡單的示例:

    實際使用中發現默認管理員、用戶與工作組使用的配置均為空{},而且vscode自帶git配置(不需要再下載配置插件);

但為了更加美觀和智能,還是推進安裝一些插件,如:主題、圖標、語法校驗、代碼格式化、代碼提示、編輯器背景色或布局等

 

推薦插件與配置】:https://zhuanlan.zhihu.com/p/64021066

 

示例1:

{ // VScode主題配置
    "editor.tabSize": 2,
    "editor.lineHeight": 24,
    "editor.renderLineHighlight": "none",
    "editor.renderWhitespace": "none",
    "editor.fontFamily": "Consolas",
    "editor.fontSize": 15,
    "editor.cursorBlinking": "smooth",
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.formatOnPaste": true,
    // 是否允許自定義的snippet片段提示,比如自定義的vue片段開啟后就可以智能提示
    "editor.snippetSuggestions": "top",
    "workbench.iconTheme": "vscode-icons",
    "workbench.colorTheme": "One Dark Pro Vivid",
    "workbench.startupEditor": "newUntitledFile",
    "html.suggest.angular1": false,
    "html.suggest.ionic": false,
    "files.trimTrailingWhitespace": true,
    // vetur插件格式化使用beautify內置規則
    "vetur.format.defaultFormatter.html": "js-beautify-html",
    // VScode 文件搜索區域配置
    "search.exclude": {
        "**/dist": true,
        "**/build": true,
        "**/elehukouben": true,
        "**/.git": true,
        "**/.gitignore": true,
        "**/.svn": true,
        "**/.DS_Store": true,
        "**/.idea": true,
        "**/.vscode": false,
        "**/yarn.lock": true,
        "**/tmp": true
    },
    // 排除文件搜索區域,比如node_modules(貼心的默認設置已經屏蔽了)
    "files.exclude": {
        "**/.idea": true,
        "**/yarn.lock": true,
        "**/tmp": true
    },
    // 配置文件關聯,以便啟用對應的智能提示,比如wxss使用css
    "files.associations": {
        "*.vue": "vue",
        "*.wxss": "css"
    },
    // 配置emmet是否啟用tab展開縮寫
    "emmet.triggerExpansionOnTab": true,
    // 配置emmet對文件類型的支持,比如vue后綴文件按照html文件來進行emmet擴寫
    "emmet.syntaxProfiles": {
        "vue-html": "html",
        "vue": "html",
        "javascript": "javascriptreact",
        // xml類型文件默認都是單引號,開啟對非單引號的emmet識別
        "xml": {
            "attr_quotes": "single"
        }
    },
    // 在react的jsx中添加對emmet的支持
    "emmet.includeLanguages": {
        "jsx-sublime-babel-tags": "javascriptreact"
    },
    // 是否開啟eslint檢測
    "eslint.enable": false,
    // 文件保存時,是否自動根據eslint進行格式化
    "eslint.autoFixOnSave": true,
    // eslint配置文件
    "eslint.options": {
        "plugins": [
            "html",
            "javascript",
            {
                "language": "vue",
                "autoFix": true
            },
            "vue"
        ]
    },
    // eslint能夠識別的文件后綴類型
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        "html",
        "vue",
        "typescript",
        "typescriptreact"
    ],
    // 快捷鍵方案,使用sublime的一套快捷鍵
    "sublimeTextKeymap.promptV3Features": true,
    // 格式化快捷鍵 shirt+alt+F
    // prettier進行格式化時是否安裝eslint配置去執行,建議false
    "prettier.eslintIntegration": true,
    // 如果為true,將使用單引號而不是雙引號
    "prettier.singleQuote": true,
    // 細節,配置gitlen中git提交歷史記錄的信息顯示情況
    "gitlens.advanced.messages": {
        "suppressCommitHasNoPreviousCommitWarning": false,
        "suppressCommitNotFoundWarning": false,
        "suppressFileNotUnderSourceControlWarning": false,
        "suppressGitVersionWarning": false,
        "suppressLineUncommittedWarning": false,
        "suppressNoRepositoryWarning": false,
        "suppressResultsExplorerNotice": false,
        "suppressUpdateNotice": true,
        "suppressWelcomeNotice": false
    },
    // 開啟apicloud在vscode中的wifi真機同步
    "apicloud.port": "23450",
    // 設置apicloud在vscode中的wifi真機同步根目錄
    "apicloud.subdirectories": "/apiclouduser",
    // git是否啟用自動拉取
    "git.autofetch": true,
    "vsicons.dontShowNewVersionMessage": true,
    "window.zoomLevel": 0,
    "colorize.ignore_search_variables_info": true,
    "files.autoSave": "afterDelay",
    "[jsonc]": {
        "editor.defaultFormatter": "vscode.json-language-features"
    }
}

示例2:

{
  "workbench.startupEditor": "welcomePage",
  "vetur.format.defaultFormatter.js": "vscode-typescript",
  "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
  "editor.quickSuggestions": {
      "other": true,
      "comments": true,
      "strings": true
  },
  // 是否允許自定義的snippet片段提示,比如自定義的vue片段開啟后就可以智能提示
  "editor.snippetSuggestions": "top",
  "workbench.iconTheme": "vscode-icons",
  "editor.tabSize": 2,
  "eslint.validate": [
    // "javascript",
    "javascriptreact",
    "html",
    "vue",
    {
      "language": "html",
      "autoFix": true
    }
  ],
  "eslint.autoFixOnSave": true,
  "window.zoomLevel": 0,
  "search.location": "panel",
  "gitlens.advanced.fileHistoryFollowsRenames": false,
  "peacock.favoriteColors": [
    {
      "name": "Angular Red",
      "value": "#b52e31"
    },
    {
      "name": "Auth0 Orange",
      "value": "#eb5424"
    },
    {
      "name": "Azure Blue",
      "value": "#007fff"
    },
    {
      "name": "C# Purple",
      "value": "#68217A"
    },
    {
      "name": "Gatsby Purple",
      "value": "#639"
    },
    {
      "name": "Go Cyan",
      "value": "#5dc9e2"
    },
    {
      "name": "Java Blue-Gray",
      "value": "#557c9b"
    },
    {
      "name": "JavaScript Yellow",
      "value": "#f9e64f"
    },
    {
      "name": "Mandalorian Blue",
      "value": "#1857a4"
    },
    {
      "name": "Node Green",
      "value": "#215732"
    },
    {
      "name": "React Blue",
      "value": "#00b3e6"
    },
    {
      "name": "Something Different",
      "value": "#832561"
    },
    {
      "name": "Vue Green",
      "value": "#42b883"
    }
  ],
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "git.autofetch": true
}


免責聲明!

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



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