Search code examples
c#visual-studio-codehighlightomnisharp

How to disable explicit type highlight in Visual Studio Code for C#?


I installed a new version of the C# extension for Visual Studio Code, and it started to provide highlights inline for explicit typing.

How can I disable this without reverting the extension to an older version?

underlined inline highlight in c# code example


Solution

  • You want to disable the "Inlay Hints" options. I think you want to disable a few:

    • csharp.inlayHints.enableInlayHintsForTypes
    • csharp.inlayHints.enableInlayHintsForImplicitObjectCreation
    • csharp.inlayHints.enableInlayHintsForLambdaParameterTypes
    • csharp.inlayHints.enableInlayHintsForImplicitVariableTypes

    Settings JSON:

    {
      "csharp.inlayHints.enableInlayHintsForTypes": false,
      "csharp.inlayHints.enableInlayHintsForImplicitObjectCreation": false,
      "csharp.inlayHints.enableInlayHintsForLambdaParameterTypes": false,
      "csharp.inlayHints.enableInlayHintsForImplicitVariableTypes": false
    }
    

    Search "inlay" in the settings and go to the C# tab and you can find all of the various inlay options:

    c# inlay hint options