You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在VSCode中禁用TypeScript(或全局范围)的属性名高亮?

Got it, I totally get how distracting those highlighted property names (like name: in TypeScript) can be—they pull your focus away when you’re trying to dive into code logic. Let me walk you through a few ways to disable them, either just for TypeScript or across all languages in VS Code.

Option 1: Quick fix via VS Code’s Settings UI (no code needed)

If you want a straightforward way to turn off all semantic highlighting for TypeScript (which includes those property names):

  • Open the Settings panel: Press Ctrl+, (Windows/Linux) or Cmd+, (Mac), or click the gear icon in the bottom-left corner and select "Settings".
  • In the search bar, type typescript.semanticHighlighting.enabled.
  • Uncheck the box next to this option. That’s it—TypeScript will stop highlighting property names (and other semantic tokens like types or functions).

Option 2: Precise control with settings.json

If you only want to disable property name highlighting without touching other semantic highlights (like function or type colors), this is the way to go.

For TypeScript only

  1. Open settings.json: Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac), type "Open Settings (JSON)", and hit Enter.
  2. Add this block to the file (replace #cccccc with your editor’s default text color to make property names blend in):
"editor.tokenColorCustomizations": {
  "typescript": {
    "semanticTokens": {
      "property": {
        "foreground": "#cccccc"
      }
    }
  }
}

For all languages globally

If you want to disable property name highlighting everywhere (not just TypeScript), use this instead:

"editor.tokenColorCustomizations": {
  "semanticTokens": {
    "property": {
      "foreground": "#cccccc"
    }
  }
}

Note for theme-specific issues

If the above doesn’t work, your active theme might override these settings. Target your theme directly by adding its name in brackets:

"editor.tokenColorCustomizations": {
  "[Your Theme Name]": {
    "semanticTokens": {
      "property": {
        "foreground": "#cccccc"
      }
    }
  }
}

Option 3: Nuke all semantic highlighting globally

If you don’t want any semantic highlights at all across every language, just set:

"editor.semanticHighlighting.enabled": false

内容的提问来源于stack exchange,提问作者mandaputtra

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 04:58:15