Colorizer.GetLineInfo Method (IVsTextLines, Int32, IVsTextColorState)


Returns color information about the specified line.

Namespace:   Microsoft.VisualStudio.Package
Assembly:  Microsoft.VisualStudio.Package.LanguageService.14.0 (in Microsoft.VisualStudio.Package.LanguageService.14.0.dll)

public virtual TokenInfo[] GetLineInfo(
	IVsTextLines buffer,
	int line,
	IVsTextColorState colorState


Type: Microsoft.VisualStudio.TextManager.Interop.IVsTextLines

[in] An IVsTextLines object containing the entire source file.

Type: System.Int32

[in] The index of the line for which to get color information.

Type: Microsoft.VisualStudio.TextManager.Interop.IVsTextColorState

[in] An IVsTextColorState object from which cached state information can be obtained for a line.

Return Value

Type: Microsoft.VisualStudio.Package.TokenInfo[]

If successful, returns an array of TokenInfo objects describing each token on the line; otherwise, returns a null value.

This method returns color and font information about the specified line of text. This information is stored in an array of TokenInfo objects, one object for each token on the line. Override this method in your own class derived from the Colorizer class to implement more sophisticated caching.

The base method uses the cached line state if the line number is the same as the last time this method was called. Otherwise, GetColorInfo is called to generate the color information and fill the cache. Finally, the cache's TokenInfo array is returned from this method. Note that only one line is cached.

Return to top