Compartilhar via


TokenColor Enumeration

Provides initial values for color indices as reported by an IScanner scanner.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)

Syntax

'Declaration
Public Enumeration TokenColor
public enum TokenColor
public enum class TokenColor
type TokenColor
public enum TokenColor

Members

Member name Description
Comment = 2. Represents the color for a comment.
Identifier = 3. Represents the color for an identifier or name (for example, a class, method, or variable name).
Keyword = 1. Represents the color for a language keyword (for example, "for", "if", or "else").
Number = 5. Represents the color for a number (a string of decimal or hexadecimal digits).
String = 4. Represents the color for a string, typically bounded by single or double quotes.
Text = 0. The default. This represents the color corresponding to the user's default text colors (the language service's ColorableItem list is ignored in this one case).

Remarks

To support syntax highlighting, the language service scanner must identify each language element as a token and provide a color value for that token. This value is actually an index into a ColorableItem list. The language service can supply a custom list of ColorableItem objects or the language service can rely on a default list of ColorableItem objects supplied by Visual Studio. The index into either list has the type TokenColor.

If you are supplying custom ColorableItem objects from your language service, it is recommended that you adhere to the meaning of the labels for the first six token types in your language. However, you can readily expand on the choices here, adding additional elements as needed. Note that the first colorable item is always ignored as Visual Studio supplies its own values for plain text.

See Also

Reference

Microsoft.VisualStudio.Package Namespace