VScode vue代码高亮?

如图
为什么引入的组件没有颜色区分?以前还有来着。是什么原因呢?
用的 vetur

阅读 2.7k
1 个回答
{
  "path-autocomplete.extensionOnImport": true,
  "path-autocomplete.pathMappings": {
    "@": "${folder}/src"
  },
  "files.associations": {
    "*.pdf": "plaintext"
  },
  "editor.cursorSmoothCaretAnimation": "on",
  "files.autoGuessEncoding": true,
  "vetur.format.defaultFormatter.html": "js-beautify-html",
  "eslint.validate": [
    "javascript",
    "html"
  ],
  "eslint.options": {
    "plugins": [
      "html"
    ]
  },
  "workbench.colorTheme": "Monokai",
  "editor.fontSize": 18,
  "editor.cursorStyle": "line-thin",
  "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
  // vscode默认启用了根据文件类型自动设置tabsize的选项
  "editor.detectIndentation": false,
  // 重新设定tabsize
  "editor.tabSize": 2,
  // #每次保存的时候自动格式化
  // "editor.formatOnSave": true,
  "eslint.debug": true,
  "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)"
  ],
  // 开启 vscode 文件路径导航
  "breadcrumbs.enabled": true,
  "vetur.format.defaultFormatterOptions": {
    "prettier": {
      "semi": false, // 格式化不加分号
      "singleQuote": true // 格式化以单引号为主
    }
  },
  //分号和双引号确实不会再自动添加了,但是不会在方法括号之间插入空格,可以再加入这条配置即可
  "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
  "vetur.format.defaultFormatter.js": "vscode-typescript",
  "[jsonc]": {
    "editor.defaultFormatter": "vscode.json-language-features"
  },
  "emmet.triggerExpansionOnTab": true,
  "javascript.eslint.enable": true,
  // 保存代码,不自动格式化
  // "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "eslint.autoFixOnSave": false,
  "eslint.options": {
    "extensions": [
      ".js",
      ".vue"
    ]
  },
  "eslint.validate": [
    "javascript",
    {
      "language": "vue",
      "autoFix": true
    },
    "html",
    "vue"
  ],
  "path-intellisense.mappings": {
    "@": "${workspaceRoot}/src"
  },
  "security.workspace.trust.untrustedFiles": "open",
  "workbench.editorAssociations": {
    "*": "default",
    "*.png": "imagePreview.previewEditor",
    "*.JPG": "imagePreview.previewEditor",
    "*.jpg": "imagePreview.previewEditor"
  },
  "explorer.confirmDelete": false,
  "explorer.confirmDragAndDrop": false,
  "editor.renderControlCharacters": true,
  "workbench.iconTheme": "vscode-icons",
  "eslint.enable": false,
  "git.ignoreWindowsGit27Warning": true,
  "vsicons.dontShowNewVersionMessage": true,
  "bracket-pair-colorizer-2.depreciation-notice": false,
  "[vue]": {
    "editor.defaultFormatter": "octref.vetur"
  },
  "[html]": {
    "editor.defaultFormatter": "vscode.html-language-features"
  },
  "workbench.editor.enablePreview": false,
  "terminal.integrated.tabs.enabled": false,
  "px2rem.rootFontSize": 10,
  "workbench.startupEditor": "none",
  "window.commandCenter": true,
}

这样写就有了<TopNav>,注入也不用加属性名,直接{TopNav,}

在用户设置页面中搜索“editor.tokenColorCustomizations”。
在该设置的值中添加自定义的颜色主题配置,例如:

"editor.tokenColorCustomizations": {
    "textMateRules": [
        {
            "scope": "entity.name.tag.vue",
            "settings": {
                "foreground": "#007acc"
            }
        }
    ]
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题