Can I disable spell checking in VS 2022 for a specific file only?

Brent Hollett 5 Reputation points
2024-04-03T06:45:35.4233333+00:00

I have test code that uses a lot of specific JSON and HTML properties, and the VS spell checker has a field day. However, I do not want to ignore all these words across my project, only in this file.

Example (VB.NET):

New JProperty("id_token", "eyJ0eXAiOiJKV1QiLCJraWQiOiI5RDhsVnlBMWNJbzdkREFWVzFwVXF5eFRMMjQ9IiwiYWxnIjoiUlMyNTYifQ.eyJhdF9oYXNoIjoiaXdt")

The bold-italic sections are marked as spelling mistakes. Other flagged words in this file include openid, ldap, didp, foobar, baddata, etc.

I do not want to allow these words to be valid anywhere else in the code, but they must be here, with this formatting (all lowercase) in order to test the code. Especially annoying is the token examples that have a dozen entries in them because of the way the token is formed.

Is there any way to turn off spell checking for just this file or ignore words for just this file?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,184 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 31,086 Reputation points Microsoft Vendor
    2024-04-04T05:38:00.09+00:00

    Hello @Brent Hollett,

    Welcome to Microsoft Q&A forum.

    Detailed rules for spell checking can be customized, but I don’t think, nor I find that it’s possible to turn off spell checking for one specific file.

    There’s an option Edit > Advanced > Toggle Spell Checker. It controls the Spell Checker(turn on/turn off). VS also provides a button for quickly turn on/tun off the Spell Checker, it’s on toolbar. Maybe you can try to turn off the Spell Checker when you are focusing on the specified file and turn it on when you are not focusing on the specified file.

    User's image

    User's image

    Best Regards,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.