ly2011 / blog

前端学习笔记
https://ly2011.github.io/blog
122 stars 12 forks source link

vscode 编辑器的常用配置 #105

Open ly2011 opened 5 years ago

ly2011 commented 5 years ago
{
  "workbench.colorCustomizations": {
    "activityBar.background": "#111111",
    "activityBarBadge.background": "#FFA000",
    "list.activeSelectionForeground": "#FFA000",
    "list.inactiveSelectionForeground": "#FFA000",
    "list.highlightForeground": "#FFA000",
    "scrollbarSlider.activeBackground": "#FFA00050",
    "editorSuggestWidget.highlightForeground": "#FFA000",
    "textLink.foreground": "#FFA000",
    "progressBar.background": "#FFA000",
    "pickerGroup.foreground": "#FFA000",
    "tab.activeBorder": "#FFA000",
    "notificationLink.foreground": "#FFA000",
    "editorWidget.resizeBorder": "#FFA000",
    "editorWidget.border": "#FFA000",
    "settings.modifiedItemIndicator": "#FFA000",
    "settings.headerForeground": "#FFA000",
    "panelTitle.activeBorder": "#FFA000",
    "breadcrumb.activeSelectionForeground": "#FFA000",
    "menu.selectionForeground": "#FFA000",
    "menubar.selectionForeground": "#FFA000"
  },
  "workbench.editor.enablePreview": false,
  // 一个制表符等于的空格数。该设置在 `editor.detectIndentation` 启用时根据文件内容进行重写。
  "editor.tabSize": 2,
  "editor.lineHeight": 24,
  "editor.renderLineHighlight": "none",
  "editor.renderWhitespace": "none",
  // 控制字体系列。
  "editor.fontFamily": "'Fira Code', Consolas, 'Courier New', monospace,'宋体'",
  "editor.fontLigatures": true,
  // 以像素为单位控制字号。
  "editor.fontSize": 14,
  "editor.fontWeight": "500",
  "editor.hideCursorInOverviewRuler": true,
  "editor.overviewRulerBorder": false,
  "editor.minimap.enabled": false,
  "editor.minimap.renderCharacters": false,
  "editor.lineNumbers": "on",
  "editor.cursorStyle": "line",
  "editor.cursorBlinking": "smooth",
  "editor.wordWrap": "on",
  "editor.formatOnSave": true,
  "editor.formatOnPaste": true,
  // 控制选取范围是否有圆角
  "editor.roundedSelection": false,
  "editor.selectionHighlight": false,
  // 建议小组件的字号
  "editor.suggestFontSize": 16,
  // 是否允许自定义的snippet片段提示,比如自定义的vue片段开启后就可以智能提示
  "editor.snippetSuggestions": "top",
  "editor.quickSuggestions": {
    "other": true,
    "comments": true,
    "strings": true
  },
  // 执行文字相关的导航或操作时将用作文字分隔符的字符
  "editor.wordSeparators": "./\\()\"':,.;<>~!@#$%^&*|+=[]{}`~?",
  "editor.detectIndentation": true,
  "editor.renderIndentGuides": false,
  // Enable auto-updating of import paths when you rename a file.
  "javascript.updateImportsOnFileMove.enabled": "always",
  // 在“打开的编辑器”窗格中显示的编辑器数量。将其设置为 0 可隐藏窗格。
  "explorer.openEditors.visible": 0,
  "explorer.confirmDragAndDrop": false,
  "search.followSymlinks": false,
  "git.path": "D:/Program Files/Git/bin/git.exe",
  // 是否已启用自动刷新
  "git.autorefresh": false,
  // git是否启用自动拉取
  "git.autofetch": false,
  // 以像素为单位控制终端的字号,这是 editor.fontSize 的默认值。
  "terminal.integrated.fontSize": 14,
  // 控制终端游标是否闪烁。
  "terminal.integrated.cursorBlinking": true,
  "workbench.startupEditor": "newUntitledFile",
  "materialTheme.fixIconsRunning": false,
  "html.suggest.angular1": false,
  "html.suggest.ionic": false,
  "files.trimTrailingWhitespace": true,
  // 配置文件路径的 glob 模式以从文件监视排除。模式必须在绝对路径上匹配(例如 ** 前缀或完整路径需正确匹配)。更改此设置需要重启。如果在启动时遇到 Code 消耗大量 CPU 时间,则可以排除大型文件夹以减少初始加载。
  "files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/*/**": true,
    "**/.svn/*/**": true
  },
  // 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,
    "**/vendor": true //排除 vendor 目录
  },
  // 排除文件搜索区域,比如node_modules(贴心的默认设置已经屏蔽了)
  "files.exclude": {
    "**/.idea": true,
    "**/yarn.lock": true,
    "**/tmp": true
  },
  // 配置文件关联,以便启用对应的智能提示,比如wxss使用css
  "files.associations": {
    "*.vue": "vue",
    "*.wxss": "css",
    ".eslintrc": "json",
    "*.css": "postcss"
  },
  // 配置emmet是否启用tab展开缩写
  "emmet.triggerExpansionOnTab": true,
  "emmet.showExpandedAbbreviation": "never",
  // 配置emmet对文件类型的支持,比如vue后缀文件按照html文件来进行emmet扩写
  "emmet.syntaxProfiles": {
    "vue-html": "html",
    "vue": "html",
    "javascript": "javascriptreact",
    // xml类型文件默认都是单引号,开启对非单引号的emmet识别
    "xml": {
      "attr_quotes": "single"
    },
    "postcss": "css"
  },
  // 在react的jsx中添加对emmet的支持
  "emmet.includeLanguages": {
    "javascript": "javascriptreact",
    "jsx-sublime-babel-tags": "javascriptreact",
    "postcss": "css"
  },
  // 是否开启eslint检测
  "eslint.enable": true,
  // 文件保存时,是否自动根据eslint进行格式化
  "eslint.autoFixOnSave": true,
  // eslint配置文件
  "eslint.options": {
    "plugins": [
      "html",
      "javascript",
      {
        "language": "vue",
        "autoFix": true
      },
      "vue"
    ]
  },
  // eslint能够识别的文件后缀类型
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "html",
    "vue",
    {
      "language": "html",
      "autoFix": true
    },
    {
      "language": "vue",
      "autoFix": true
    },
    {
      "language": "javascript",
      "autoFix": true
    },
    "typescript",
    "typescriptreact"
  ],
  // 快捷键方案,使用sublime的一套快捷键
  "sublimeTextKeymap.promptV3Features": true,
  // 格式化快捷键 shirt+alt+F
  // prettier进行格式化时是否安装eslint配置去执行,建议false
  "prettier.eslintIntegration": true,
  "prettier.tslintIntegration": true,
  //分号
  "prettier.semi": false,
  // 如果为true,将使用单引号而不是双引号
  "prettier.singleQuote": true,
  "prettier.tabWidth": 2,
  "prettier.useTabs": false,
  "tslint.autoFixOnSave": true,
  // vetur插件格式化使用beautify内置规则
  "vetur.format.defaultFormatter.html": "js-beautify-html",
  //函数前加空格
  "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
  // 没有下边这个 上边不生效
  "vetur.format.defaultFormatter.js": "vscode-typescript",
  //js-beautify-html格式化配置,属性强制换行
  "vetur.format.defaultFormatterOptions": {
    "js-beautify-html": {
      // "wrap_attributes": "force-aligned"
    }
  },
  // 细节,配置gitlen中git提交历史记录的信息显示情况
  "gitlens.advanced.messages": {
    "suppressCommitHasNoPreviousCommitWarning": false,
    "suppressCommitNotFoundWarning": false,
    "suppressFileNotUnderSourceControlWarning": false,
    "suppressGitVersionWarning": false,
    "suppressLineUncommittedWarning": false,
    "suppressNoRepositoryWarning": false,
    "suppressResultsExplorerNotice": false,
    "suppressUpdateNotice": true,
    "suppressWelcomeNotice": false
  },
  // 对不属于任何工程的 JavaScript 文件启用或禁用 "experimentalDecorators" 设置。若有 jsconfig.json 或 tsconfig.json 文件,将覆盖此设置。要求工作区使用高于 2.3.1 版本的 TypeScript。
  "javascript.implicitProjectConfig.experimentalDecorators": true,
  "powermode.enabled": true,
  "powermode.presets": "flames",
  // 开启apicloud在vscode中的wifi真机同步
  "apicloud.port": "23450",
  // 设置apicloud在vscode中的wifi真机同步根目录
  "apicloud.subdirectories": "/apiclouduser",
  "terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
  "jest.autoEnable": false,

  // go配置
  "go.buildOnSave": true, //在保存代码时自动编译代码
  "go.lintOnSave": true, //在保存代码时自动检查代码可以优化的地方,并给出建议
  "go.vetOnSave": true, //在保存代码时自动检查潜在的错误
  "go.buildTags": "",
  "go.buildFlags": [],
  "go.lintTool": "golint", //使用 golint 库来执行 lint操作,你也可以选择使用gometalinter
  "go.lintFlags": [],
  "go.vetFlags": [],
  "go.coverOnSave": false, //在保存代码时执行测试,并显示测试覆盖率
  "go.useCodeSnippetsOnFunctionSuggest": true, //使用代码片段作为提示
  "go.formatOnSave": true, //在保存代码时自动格式化代码
  "go.formatTool": "goimports", //使用 goimports 工具进行代码格式化,或者使用 goreturns和gofmt
  "go.formatFlags": [],
  "go.gocodeAutoBuild": true,
  "editor.tabCompletion": true, //代码自动编译构建
  "go.goroot": "D:\\go", //设置 goroot,正常编译 go 代码。
  "go.gopath": "D:\\test\\go",
  "javascript.implicitProjectConfig.checkJs": true,
  "todo-tree.defaultHighlight": {
    "foreground": "green",
    "type": "none"
  },
  "todo-tree.customHighlight": {
    "TODO": {},
    "FIXME": {}
  },
  "editor.matchBrackets": false,
  "editor.wordWrapColumn": 120,
  "auto-close-tag.fullMode": true,
  "auto-close-tag.SublimeText3Mode": true,
  "update.enableWindowsBackgroundUpdates": false,
  "update.showReleaseNotes": false,
  "telemetry.enableCrashReporter": false,
  "telemetry.enableTelemetry": false,
  "update.channel": "none", // 设置 gopath,有利于自动导入库
  "extensions.autoCheckUpdates": false,
  "extensions.autoUpdate": false,
  "element-helper.version": "2.5",
  "typescript.updateImportsOnFileMove.enabled": "always",
  "breadcrumbs.enabled": true,
  "minapp-vscode.disableAutoConfig": true,
  "view-in-browser.customBrowser": "chrome",
  "workbench.iconTheme": "material-icon-theme"
}
ly2011 commented 5 years ago

VsCode从零开始配置一个属于自己的Vue开发环境