VS_Code 配置文件

293 阅读2分钟

个人的 vscode 配置文件

{
    // 1.prettier 格式化配置==============================================================================================================================
    // 格式化vue文件
    "[vue]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    // 杰哥推荐 ---
    // "[vue]": {
    //     "editor.defaultFormatter": "octref.vetur"
    //   },
    // "prettier.disableLanguages": ["vue"], // 不格式化vue文件,vue文件的格式化单独设置
    "[html]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[css]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[less]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[json]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[jsonc]": {
        "editor.defaultFormatter": "vscode.json-language-features"
    },
    "[typescript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    //------------------------------------------ 格式化核心部分--------------------------------------------------------------------
    "editor.formatOnSave": true, // 保存时格式化代码
    "prettier.tabWidth": 2, // 缩进字节数
    "prettier.trailingComma": "all", //尽可能控制尾随逗号的输出
    "prettier.singleQuote": true, // 使用单引号代替双引号
    "prettier.printWidth": 200, // 超过最大值换行
    "prettier.semi": true, // 句尾添加分号
    "prettier.bracketSpacing": true, // 在对象,数组括号与文字之间加空格 "{ foo: bar }"
    "prettier.arrowParens": "avoid", //  (x) => {} 箭头函数参数只有一个时是否要有小括号。avoid:省略括号
    "prettier.useTabs": false, // 缩进不使用tab,使用空格
    "prettier.htmlWhitespaceSensitivity": "strict", // 指定HTML文件的全局空白区域敏感度。 有效选项: 'css' - 尊重CSS显示属性的默认值。 'strict' - 空格被认为是敏感的。 'ignore' - 空格被认为是不敏感的。
    "prettier.jsxSingleQuote": true, // 在jsx中使用单引号代替双引号
    // ----------------------------------------------------------------------------------------------------------------------------
    "prettier.proseWrap": "preserve", // 默认值。因为使用了一些折行敏感型的渲染器(如GitHub comment)而按照markdown文本样式进行折行
    "prettier.endOfLine": "auto", // 结尾是 \n \r \n\r auto
    "prettier.ignorePath": ".prettierignore", // 不使用prettier格式化的文件填写在项目的.prettierignore文件中
    "prettier.jsxBracketSameLine": false, // 在jsx中把'>' 是否单独放一行
    "prettier.parser": "babylon", // 格式化的解析器,默认是babylon
    "prettier.requireConfig": false, // Require a 'prettierconfig' to format prettier
    // ==================================================================================================================================
    // 2.vetur配置===================================================================================
    "vetur.ignoreProjectWarning": true, //gnore忽略项目警告: Vetur将警告项目没有正确设置。你可以禁用它。
    "vetur.format.scriptInitialIndent": true, //是否对 <script> 区域具有初始缩进
    // ===============================================================================================
    // ===========================================================================================================
    // 4.indentRainbow 插件缩进颜色====
    "indentRainbow.colors": [
        "rgba(255,255,64,0.07)",
        "rgba(127,255,127,0.07)",
        "rgba(255,127,255,0.07)",
        "rgba(79,236,236,0.07)"
    ],
    // =================================
    // 5.ESlint 配置======================================================================
    // "eslint.enable": true, //启用 ESlint 作为格式化器
    "eslint.run": "onType", // Eslint:跑在save (onSave)或type (ontype)上运行linteronType
    "eslint.options": {
        "extensions": [
            ".js",
            ".vue",
            ".jsx",
            ".tsx"
        ]
    },
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    },
    // ===================================================================================
    // 启用或禁用在 VS Code 中重命名或移动文件时自动更新导入路径的功能。always: 始终自动更新路径。
    "javascript.updateImportsOnFileMove.enabled": "always",
    // 指定工作台中使用的文件图标主题
    "workbench.iconTheme": "material-icon-theme",
    // 没有可提交的暂存更改 , 是否要暂存所有更改并直接提交? --- 总是
    "git.enableSmartCommit": true,
    // 控制资源管理器是否在把文件删除到废纸篓时进行确认。
    "explorer.confirmDelete": false,
    // 控制终端的字号(以像素为单位)。
    "terminal.integrated.fontSize": 14,
    // 控制调试控制台中的字体大小(以像素为单位)。
    "debug.console.fontSize": 14,
    // 操作时作为单词分隔符的字符
    "editor.wordSeparators": "`~!@#%^&*()=+[{]}\\|;:'\",.<>/?",
    // 对 {{#foo}} 和 {{/foo}} 进行格式化与缩进。
    "html.format.indentHandlebars": true,
    // ----------------------------------------------------------------------------------------------------
    // ----------------------------------------------------------------------------------------------------
    // ---------------
    "sync.gist": "fb0169cb2661d1a46179214b91559996",
    "editor.formatOnType": true,
    "editor.cursorBlinking": "expand",
    "markdown.extension.preview.autoShowPreviewToSide": true,
    "material-icon-theme.activeIconPack": "react",
    "markdown-preview-enhanced.previewTheme": "vue.css",
    "liveServer.settings.donotShowInfoMsg": true,
    "security.workspace.trust.untrustedFiles": "open",
    // 把 less 文件编译成后缀名是 wxss 的文件 ,小程序使用less开发
    "less.compile": {
        "outExt": ".wxss"
    },
    "git.ignoreMissingGitWarning": true,
    "files.associations": {
        "*.wxml": "html",
        "*.wxss": "css",
    },
    "emmet.triggerExpansionOnTab": true,
    "git.confirmSync": false,
    "workbench.colorTheme": "GitHub Dark Default",
    "px-to-vw.viewportWidth": 1940,
    "px-to-vw.unitPrecision": 6, // tab键快捷生成元素html标签
}