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

Visual Studio Code中忽略未知单词的方法:Python代码编写时下划线标记问题解决

Fixing Unwanted Underlines in VSCode Python Code

Hey there! Let me walk you through how to get rid of those annoying underlines on your Python variables and words in VSCode, plus break down that config you found:

First, let’s clarify the cSpell.diagnosticLevel config

That setting is tied to the Code Spell Checker extension (the tool adding those underlines to flag unrecognized words as potential spelling mistakes). You don’t need to run it in the terminal—this is a VSCode configuration option, not a command. Here’s what it means:

  • By default, the plugin marks unrecognized words as either Error or Warning, which shows up as prominent red/yellow underlines.
  • Setting "cSpell.diagnosticLevel": "Hint" downgrades those markers to a faint hint level (usually a light gray underline, or none at all depending on your theme), so they won’t distract you while coding.

How to apply this config

You can set it two simple ways:

  1. Via the GUI settings:
    • Press Ctrl+, (Windows/Linux) or Cmd+, (Mac) to open VSCode’s settings panel
    • Search for cSpell.diagnosticLevel in the top search bar
    • From the dropdown menu, select Hint
  2. Directly in settings.json:
    • Open the command palette with Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac)
    • Search for "Preferences: Open Settings (JSON)"
    • Add the line "cSpell.diagnosticLevel": "Hint" to the JSON object, save the file, and the changes will take effect right away.

A more permanent fix (if you don’t need spell checking)

As you discovered later, disabling the Code Spell Checker extension entirely will eliminate those underlines for good:

  • Open the extensions panel with Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (Mac)
  • Search for "Code Spell Checker"
  • Click the "Disable" button on the extension card (you can even uninstall it if you never plan to use spell checking in your code)

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.28 18:59:09