Condividi tramite


Colorizer.GetLineInfo Method

Returns color information about the specified line.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.0.dll)
  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)

Syntax

'Declaration
Public Overridable Function GetLineInfo ( _
    buffer As IVsTextLines, _
    line As Integer, _
    colorState As IVsTextColorState _
) As TokenInfo()
public virtual TokenInfo[] GetLineInfo(
    IVsTextLines buffer,
    int line,
    IVsTextColorState colorState
)
public:
virtual array<TokenInfo^>^ GetLineInfo(
    IVsTextLines^ buffer, 
    int line, 
    IVsTextColorState^ colorState
)
abstract GetLineInfo : 
        buffer:IVsTextLines * 
        line:int * 
        colorState:IVsTextColorState -> TokenInfo[] 
override GetLineInfo : 
        buffer:IVsTextLines * 
        line:int * 
        colorState:IVsTextColorState -> TokenInfo[] 
public function GetLineInfo(
    buffer : IVsTextLines, 
    line : int, 
    colorState : IVsTextColorState
) : TokenInfo[]

Parameters

  • line
    Type: Int32

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

Return Value

Type: array<Microsoft.VisualStudio.Package.TokenInfo[]
If successful, returns an array of TokenInfo objects describing each token on the line; otherwise, returns a null value.

Remarks

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.

.NET Framework Security

See Also

Reference

Colorizer Class

Microsoft.VisualStudio.Package Namespace