Condividi tramite


Colorizer.GetLineInfo(IVsTextLines, Int32, IVsTextColorState) Method

Definition

Returns color information about the specified line.

public:
 virtual cli::array <Microsoft::VisualStudio::Package::TokenInfo ^> ^ GetLineInfo(Microsoft::VisualStudio::TextManager::Interop::IVsTextLines ^ buffer, int line, Microsoft::VisualStudio::TextManager::Interop::IVsTextColorState ^ colorState);
 virtual std::Array <Microsoft::VisualStudio::Package::TokenInfo const &> GetLineInfo(Microsoft::VisualStudio::TextManager::Interop::IVsTextLines const & buffer, int line, Microsoft::VisualStudio::TextManager::Interop::IVsTextColorState const & colorState);
public virtual Microsoft.VisualStudio.Package.TokenInfo[] GetLineInfo (Microsoft.VisualStudio.TextManager.Interop.IVsTextLines buffer, int line, Microsoft.VisualStudio.TextManager.Interop.IVsTextColorState colorState);
abstract member GetLineInfo : Microsoft.VisualStudio.TextManager.Interop.IVsTextLines * int * Microsoft.VisualStudio.TextManager.Interop.IVsTextColorState -> Microsoft.VisualStudio.Package.TokenInfo[]
override this.GetLineInfo : Microsoft.VisualStudio.TextManager.Interop.IVsTextLines * int * Microsoft.VisualStudio.TextManager.Interop.IVsTextColorState -> Microsoft.VisualStudio.Package.TokenInfo[]
Public Overridable Function GetLineInfo (buffer As IVsTextLines, line As Integer, colorState As IVsTextColorState) As TokenInfo()

Parameters

buffer
IVsTextLines

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

line
Int32

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

colorState
IVsTextColorState

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

Returns

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.

Applies to