VScode-插件使用以及配置项

1.vscode 版本:

  版本: 1.56.2 (user setup)

  在最新版本中,vscode增加了账户登录选项,实现了配置文件保存在账户中,在更换电脑或者端时,可以直接登录自己账号获取云端vscode配置。

2.配置保存路径

  github

3.setting.json

 

{
    // 对应文件类型使用prettier格式化插件
    "[scss]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[less]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[typescript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[vue]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[jsonc]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[json]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[html]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[css]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[typescriptreact]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[javascriptreact]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    // ---------- editor ---------------------------------
    // 编辑器将不再对屏幕阅读器的使用进行优化
    "editor.accessibilitySupport": "off",
    // 控制是否启用平滑插入动画
    "editor.cursorSmoothCaretAnimation": true,
    // 控制 "查找小部件" 是否应在编辑器顶部添加额外的行。如果为 true, 则可以在 "查找小工具" 可见时滚动到第一行之外。
    "editor.find.addExtraSpaceOnTop": false,
    // 显式 "font-feature-settings" CSS 属性。如果只需打开/关闭连字,可以改为传递布尔值
    "editor.fontLigatures": "'ss01', 'ss02', 'ss03', 'ss06', 'zero'",
    // 控制编辑器是否应呈现垂直字形边距。字形边距最常用于调试。
    "editor.glyphMargin": true,
    // 在编辑器中启用内连提示
    "editor.inlayHints.enabled": true,
    // 每10行显示行号
    "editor.lineNumbers": "interval",
    // ctrlCmd: 映射为 Ctrl (Windows 和 Linux) 或 Command (macOS)。
    "editor.multiCursorModifier": "ctrlCmd",
    // 控制编辑器在空白字符上显示符号的方式。boundary: 呈现空格字符(字词之间的单个空格除外)
    "editor.renderWhitespace": "boundary",
    // 控制是否突出显示仅保留空格或完全没有宽度的字符
    "editor.unicodeHighlight.invisibleCharacters": false,
    // 保存时运行的代码操作
    "editor.codeActionsOnSave": {
        // 控制是否应在文件保存时运行自动修复操作。
        "source.fixAll": false,
        "source.fixAll.eslint": true,
        // 控制是否应在文件保存时运行"整理 import 语句"操作。
        "source.organizeImports": true
    },
    // 控制是否显示缩略图
    "editor.minimap.enabled": false,
    // 空格数
    "editor.tabSize": 4,
    // 在保存时格式化文件。格式化程序必须可用,延迟后文件不能保存,并且编辑器不能关闭
    "editor.formatOnSave": true,
    // 控制在建议列表中如何预先选择建议
    "editor.suggestSelection": "first",
    // 控制是否启用括号对着色。使用 “workbench.colorCustomizations” 替代括号突出显示颜色
    "editor.bracketPairColorization.enabled": true,
    // 控制是否启用括号对指南。
    "editor.guides.bracketPairs": "active",
    // 未突出显示在允许区域设置中常见的 Unicode 字符。
    "editor.unicodeHighlight.allowedLocales": {
        "zh-hans": true
    },
    // 控制是否在编辑器中自动显示内联建议
    "editor.inlineSuggest.enabled": true,
    // 控制编辑器是否已启用链接编辑。相关符号(如 HTML 标记)在编辑时进行更新,具体由语言而定。
    "editor.linkedEditing": true,

    // ----------    explorer  -------------------------
    // 控制资源管理器是否在把文件删除到废纸篓时进行确认。
    "explorer.confirmDelete": false,
    // 控制在资源管理器内拖放移动文件或文件夹时是否进行确认。
    "explorer.confirmDragAndDrop": false,

    // -------------- window  ---------------------
    // 如果已设置,则根据 OS 外观自动切换到首选颜色主题
    "window.autoDetectColorScheme": true,
    // 调整对话框窗口的外观
    "window.dialogStyle": "custom",
    // 启用 macOS Sierra 窗口选项卡 // macOS only
    "window.nativeTabs": true,
    // 调整窗口标题栏的外观
    "window.titleBarStyle": "custom",

    // 控制工作台中活动栏的可见性
    "workbench.activityBar.visible": true,
    // 文件目录结构的icon主题样式
    "workbench.iconTheme": "material-icon-theme",
    "workbench.editor.closeOnFileDelete": true,
    "workbench.editor.highlightModifiedTabs": true,

    // 控制扩展的自动更新行为
    "extensions.autoUpdate": "onlyEnabledExtensions",

    // vetur格式化的配置
    "vetur.format.defaultFormatter.html": "prettier",
    "vetur.format.defaultFormatter.css": "prettier",
    "vetur.format.defaultFormatter.js": "prettier-eslint",
    "vetur.format.defaultFormatter.less": "prettier",
    "vetur.format.defaultFormatter.postcss": "prettier",
    "vetur.format.defaultFormatter.sass": "sass-formatter",
    "vetur.format.defaultFormatter.scss": "prettier",
    "vetur.format.defaultFormatter.ts": "prettier-tslint",
    "vetur.format.enable": true,
    "vetur.format.options.useTabs": true,
    "vetur.format.scriptInitialIndent": false,
    "vetur.format.styleInitialIndent": false,
    "vetur.languageFeatures.updateImportOnFileMove": true,
    "vetur.validation.script": true,
    "vetur.validation.style": true,
    "vetur.validation.templateProps": true,
    "vetur.format.options.tabSize": 4,
    "vetur.validation.template": false,
    "vetur.completion.autoImport": true,

    // vite config
    "vite.autoStart": false,
    "vite.browserType": "system",
    "vite.notifyOnStarted": false,
    "vite.showTerminal": true,

    // volar config
    "volar.completion.autoImportComponent": true,
    "volar.completion.preferredAttrNameCase": "auto-camel",
    "volar.formatting.printWidth": 200,
    "volar.autoCompleteRefs": true,
    "volar.codeLens.pugTools": false,
    "volar.codeLens.scriptSetupTools": true,
    "volar.completion.preferredTagNameCase": "pascal",

    // 其它文件名映射
    "files.associations": {
        "*.cjson": "jsonc",
        "*.wxss": "css",
        "*.wxs": "javascript",
        "*.jsp": "html",
        "*.wxml": "html"
    },

    // 在不受支持的语言中启用标签缩写 例如jsx
    "emmet.includeLanguages": {
        "wxml": "html",
        "vue-html": "html",
        "jsx": "javascript",
        "javascript": "javascriptreact",
        "typescript": "typescriptreact"
    },
    "emmet.showSuggestionsAsSnippets": true,
    "emmet.triggerExpansionOnTab": false,

    // 默认从当前git存储库的远程库进行提交拉取
    "git.autofetch": true,
    "git.ignoreMissingGitWarning": true,
    "git.confirmSync": false,
    "git.enableSmartCommit": true,
    "git.untrackedChanges": "separate",

    "files.eol": "\n",
    "files.insertFinalNewline": true,
    "files.simpleDialog.enable": true,

    "terminal.integrated.cursorBlinking": true,
    "terminal.integrated.cursorStyle": "line",
    "terminal.integrated.fontWeight": "300",
    "terminal.integrated.persistentSessionReviveProcess": "never",
    "terminal.integrated.tabs.enabled": true,

    // prettier格式化规则
    "prettier.singleQuote": true,
    "prettier.jsxSingleQuote": true,
    "prettier.tabWidth": 4,
    "prettier.bracketSpacing": true,
    "prettier.arrowParens": "avoid",
    "prettier.printWidth": 200,
    "prettier.endOfLine": "crlf",
    "prettier.trailingComma": "none",
    "prettier.proseWrap": "never",
    "prettier.jsxBracketSameLine": true,

    // scss使用重复的样式定义时,报警告
    "scss.lint.duplicateProperties": "warning",

    // liveServer的配置
    "liveServer.settings.useLocalIp": true,
    "liveServer.settings.donotVerifyTags": true,
    "liveServer.settings.donotShowInfoMsg": true,

    // 解决合并冲突后自动转到下一个冲突
    "merge-conflict.autoNavigateNextConflict.enabled": true,
    "diffEditor.ignoreTrimWhitespace": false,

    // 启用js文件中的codeLen引用
    "javascript.referencesCodeLens.showOnAllFunctions": true,
    // 自动更新导入的路径
    "javascript.updateImportsOnFileMove.enabled": "always",

    // 编辑器优化
    "workbench.startupEditor": "newUntitledFile",
    "workbench.enableExperiments": false,
    "workbench.settings.enableNaturalLanguageSearch": false,
    "workbench.editor.enablePreview": false,
    "workbench.editorAssociations": {
        "*.ipynb": "jupyter.notebook.ipynb"
    },

    // vscode更新后不显示最新的发行说明
    "update.showReleaseNotes": false,

    // 对双大括号语法进行缩进
    "html.format.indentHandlebars": true,
    // 属性垂直对齐
    "html.format.wrapAttributes": "aligned-multiple",
    "typescript.updateImportsOnFileMove.enabled": "always",

    // markdown预览字体
    "markdown.preview.fontFamily": "Consolas, 'Courier New', monospace",

    // cSpell配置
    "cSpell.allowCompoundWords": true,
    "cSpell.language": "en,en-US",
    "cSpell.userWords": ["gulpfile", "happypack", "mixins", "vant", "vite", "vuex"],
    "cSpell.enabledLanguageIds": [
        "css",
        "git-commit",
        "html",
        "javascript",
        "javascriptreact",
        "json",
        "jsonc",
        "less",
        "markdown",
        "rust",
        "scss",
        "text",
        "typescript",
        "typescriptreact",
        "yaml",
        "yml",
        "vue"
    ],
    "cSpell.enableFiletypes": ["vue", "js", "css", "html"],
    "cSpell.includeRegExpList": ["src"],

    // githubCopilot配置
    "github.copilot.enable": {
        "*": true,
        "yaml": false,
        "plaintext": true,
        "markdown": true
    },

    "search.exclude": {
        "**/.git": true,
        "**/.github": true,
        "**/.nuxt": true,
        "**/.output": true,
        "**/.pnpm": true,
        "**/.vscode": true,
        "**/.yarn": true,
        "**/bower_components": true,
        "**/dist/**": true,
        "**/logs": true,
        "**/node_modules": true,
        "**/out/**": true,
        "**/package-lock.json": true,
        "**/pnpm-lock.yaml": true,
        "**/tmp": true,
        "**/yarn.lock": true
    },
    //配置eslint
    "eslint.codeActionsOnSave.mode": "problems",
    "eslint.packageManager": "pnpm",
    "eslint.quiet": true,
    "eslint.validate": ["javascript", "typescript", "javascriptreact", "typescriptreact", "vue", "html", "markdown", "json", "jsonc", "json5"],

    // explorer.experimental.fileNesting.patterns

    "explorer.experimental.fileNesting.enabled": true,
    "explorer.experimental.fileNesting.expand": false,
    "explorer.experimental.fileNesting.patterns": {
        ".gitignore": ".gitattributes, .gitmodules, .gitmessage, .mailmap, .git-blame*",
        "*.js": "$(capture).js.map, $(capture).min.js, $(capture).d.ts",
        "*.jsx": "$(capture).js",
        "*.ts": "$(capture).js, $(capture).*.ts",
        "*.tsx": "$(capture).ts",
        "*.vue": "$(capture).*.ts, $(capture).*.js",
        "index.d.ts": "*.d.ts",
        "shims.d.ts": "*.d.ts",
        "*.cpp": "$(capture).hpp, $(capture).h, $(capture).hxx",
        "*.cxx": "$(capture).hpp, $(capture).h, $(capture).hxx",
        "*.cc": "$(capture).hpp, $(capture).h, $(capture).hxx",
        "*.c": "$(capture).h",
        "go.mod": ".air*, go.sum",
        "default.nix": "shell.nix",
        "flake.nix": "flake.lock",
        "BUILD.bazel": "*.bzl, *.bazel, *.bazelrc, bazel.rc, .bazelignore, .bazelproject, WORKSPACE",
        "CMakeLists.txt": "*.cmake, *.cmake.in, .cmake-format.yaml, CMakePresets.json",
        ".clang-tidy": ".clang-format",
        ".env": "*.env, .env.*, env.d.ts",
        "dockerfile": ".dockerignore, dockerfile*",
        "package.json": ".browserslist*, .circleci*, .codecov, .commitlint*, .editorconfig, .eslint*, .firebase*, .flowconfig, .github*, .gitlab*, .gitpod*, .huskyrc*, .jslint*, .lintstagedrc*, .markdownlint*, .mocha*, .node-version, .nodemon*, .npm*, .nvmrc, .pm2*, .pnp.*, .pnpm*, .prettier*, .releaserc*, .sentry*, .stackblitz*, .styleci*, .stylelint*, .tazerc*, .textlint*, .tool-versions, .travis*, .vscode*, .watchman*, .xo-config*, .yamllint*, .yarnrc*, api-extractor.json, appveyor*, ava.config.*, azure-pipelines*, bower.json, build.config.*, commitlint*, crowdin*, cypress.json, dangerfile*, dprint.json, firebase.json, grunt*, gulp*, jasmine.*, jenkins*, jest.config.*, jsconfig.*, karma*, lerna*, lint-staged*, nest-cli.*, netlify*, nodemon*, nx.*, package-lock.json, playwright.config.*, pm2.*, pnpm*, prettier*, pullapprove*, puppeteer.config.*, renovate*, rollup.config.*, stylelint*, tsconfig.*, tsdoc.*, tslint*, tsup.config.*, turbo*, typedoc*, vercel*, vetur.config.*, vitest.config.*, webpack.config.*, workspace.json, xo.config.*, yarn*",
        "rush.json": ".browserslist*, .circleci*, .codecov, .commitlint*, .editorconfig, .eslint*, .firebase*, .flowconfig, .github*, .gitlab*, .gitpod*, .huskyrc*, .jslint*, .lintstagedrc*, .markdownlint*, .mocha*, .node-version, .nodemon*, .npm*, .nvmrc, .pm2*, .pnp.*, .pnpm*, .prettier*, .releaserc*, .sentry*, .stackblitz*, .styleci*, .stylelint*, .tazerc*, .textlint*, .tool-versions, .travis*, .vscode*, .watchman*, .xo-config*, .yamllint*, .yarnrc*, api-extractor.json, appveyor*, ava.config.*, azure-pipelines*, bower.json, build.config.*, commitlint*, crowdin*, cypress.json, dangerfile*, dprint.json, firebase.json, grunt*, gulp*, jasmine.*, jenkins*, jest.config.*, jsconfig.*, karma*, lerna*, lint-staged*, nest-cli.*, netlify*, nodemon*, nx.*, package-lock.json, playwright.config.*, pm2.*, pnpm*, prettier*, pullapprove*, puppeteer.config.*, renovate*, rollup.config.*, stylelint*, tsconfig.*, tsdoc.*, tslint*, tsup.config.*, turbo*, typedoc*, vercel*, vetur.config.*, vitest.config.*, webpack.config.*, workspace.json, xo.config.*, yarn*",
        "readme.*": "authors, backers.md, changelog*, citation*, code_of_conduct.md, codeowners, contributing.md, contributors, copying, credits, governance.md, history.md, license*, maintainers, readme*, security.md, sponsors.md",
        "cargo.toml": ".clippy.toml, .rustfmt.toml, cargo.lock, clippy.toml, cross.toml, rust-toolchain.toml, rustfmt.toml",
        "gemfile": ".ruby-version, gemfile.lock",
        "composer.json": "composer.lock, phpunit.xml*, psalm*.xml",
        "vite.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .htmlnanorc*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, cssnano.config.*, cypress.json, env.d.ts, htmlnanorc.*, index.html, jasmine.*, jest.config.*, jsconfig.*, karma*, playwright.config.*, postcss.config.*, puppeteer.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*",
        "vue.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .htmlnanorc*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, cssnano.config.*, cypress.json, env.d.ts, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, playwright.config.*, postcss.config.*, puppeteer.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*",
        "nuxt.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .htmlnanorc*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, cssnano.config.*, cypress.json, env.d.ts, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, playwright.config.*, postcss.config.*, puppeteer.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*",
        "next.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .htmlnanorc*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, cssnano.config.*, cypress.json, env.d.ts, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, next-env.d.ts, playwright.config.*, postcss.config.*, puppeteer.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*",
        "svelte.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .htmlnanorc*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, cssnano.config.*, cypress.json, env.d.ts, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, mdsvex.config.js, playwright.config.*, postcss.config.*, puppeteer.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*",
        "remix.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .htmlnanorc*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, cssnano.config.*, cypress.json, env.d.ts, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, playwright.config.*, postcss.config.*, puppeteer.config.*, remix.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*"
    }
}

 

posted @ 2020-06-02 17:38  半糖也甜吖  阅读(2132)  评论(1编辑  收藏  举报