共用方式為


How to: Use built-in colorable items

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Before you use the built-in colorable items, you must first signal to the integrated development environment (IDE) that you are not providing your own custom colorable items, which in this case would be IVsProvideColorableItems objects. You do this by setting a registry entry for the language service.

To use built-in colorable items

  1. Under HKEY_LOCAL_MACHINE\VisualStudio\<X.Y>\Languages\Language Services\<Language Name>, where <X.Y> is a version of Visual Studio and <Language Name> is the name of your language, create a DWORD registry entry value called RequestStockColors.

  2. Set the RequestStockColors registry entry value to 1.

    After you create the registry entry, your colorizer's ColorizeLine method can use the members of the DEFAULTITEMS enumeration to fill in the array of color attributes for use by the editor.

    Note

    Do not set this registry entry if you are providing custom colorable items. For more information, see Custom colorable items.

See also