How to Disable the Red Underlines in VS Code

Introduction

Visual Studio Code (VS Code) is a powerful, lightweight, and versatile source code editor that supports various programming languages. One of its many features is the red wavy underline, which signifies errors in your code.

While this feature is very useful for catching mistakes, it can sometimes be overzealous or distracting. This Byte will show you how to manage these underlines in VS Code.

What do the red lines mean?

The red wavy underline is a feature of VS Code's IntelliSense. It's a way to show that there might be an error, warning, or suggestion in your code. When you hover over the underlined code, a tooltip will show, providing more information about the issue.

Here's an example of what the red wavy underline looks like:

In the above code, the second line will have the underline because you're trying to re-assign a constant variable.

Disabling Red Underlines in VS Code

There might be instances where you'd want to disable the red wavy underlines in VS Code. Maybe you're working on a draft code, and the underlines are more distracting than helpful. Or maybe the errors that VS Code is pointing out aren't actually errors. Whatever your reasons, you can disable this feature by following these steps:

  1. Open VS Code and go to the settings by clicking on the gear icon in the lower left corner and selecting "Settings".
  2. In the search bar, type "validate" and look for settings like "JavaScript > Validate: Enable".
  3. Uncheck the box next to the languages you don't want validated.
Get free courses, guided projects, and more

No spam ever. Unsubscribe anytime. Read our Privacy Policy.

Note: Disabling these validations will stop VS Code from underlining errors, but it won't stop it from detecting them. You'll still see error messages in the "Problems" tab.

Globally Disabling Red Wavy Underlines

To globally disable red wavy underlines in VS Code, you need to modify the settings.json file. You can access this file by going to "File > Preferences > Settings". Then, you need to search for editor.underline and set it to false.

Here is an example of how to do it:

{
    "editor.underline": false
}

After saving the changes, you should no longer see the red wavy underlines in any of your files, regardless of the project.

Note: Globally disabling the red wavy underlines will affect all the projects you open with VS Code. If you want to disable them only for a specific project, refer to the next section.

Locally Disabling Red Wavy Underlines in Current Project

If you only want to disable the red underlines for the current project, you can create a .vscode/settings.json file in your project's root directory. The settings in this file will override the global settings for this specific project.

Here's how to do it:

{
    "editor.underline": false
}

Save the file and restart VS Code. Now, the underlines should be disabled for this project only.

Conclusion

Managing red underlines in VS Code can be done either globally or locally. Globally disabling them will affect all your projects, while locally disabling them will only affect the current project. Whether you choose to disable them or not depends on your personal preference and coding style. But don't forget, these underlines are there to help you catch potential issues in your code!

Last Updated: August 20th, 2023
Was this helpful?

© 2013-2024 Stack Abuse. All rights reserved.

AboutDisclosurePrivacyTerms