共用方式為


LanguageService.GetColorizer Method

Definition

Returns a colorizer object.

Overloads

GetColorizer(IVsTextLines)

Iinstantiates a Colorizer class.

GetColorizer(IVsTextLines, IVsColorizer)

Returns the colorizer associated with a Source object that contains the given IVsTextLines object.

Remarks

A colorizer object is used to colorize the source file text. This is also known as syntax highlighting. A colorizer object works with a parser to isolate the language features and provide a color for each feature on a character by character basis.

GetColorizer(IVsTextLines)

Iinstantiates a Colorizer class.

public:
 virtual Microsoft::VisualStudio::Package::Colorizer ^ GetColorizer(Microsoft::VisualStudio::TextManager::Interop::IVsTextLines ^ buffer);
public virtual Microsoft.VisualStudio.Package.Colorizer GetColorizer (Microsoft.VisualStudio.TextManager.Interop.IVsTextLines buffer);
abstract member GetColorizer : Microsoft.VisualStudio.TextManager.Interop.IVsTextLines -> Microsoft.VisualStudio.Package.Colorizer
override this.GetColorizer : Microsoft.VisualStudio.TextManager.Interop.IVsTextLines -> Microsoft.VisualStudio.Package.Colorizer
Public Overridable Function GetColorizer (buffer As IVsTextLines) As Colorizer

Parameters

buffer
IVsTextLines

[in] An IVsTextLines object representing the buffer of text to colorize.

Returns

If successful, returns a Colorizer object; otherwise, returns a null value.

Remarks

This method returns a new instance of a Colorizer object. If you need to supply functionality beyond what the base Colorizer class offers, then you must derive a class from the Colorizer class and return an instance of your class. This is typically not necessary as the existing Colorizer class handles all colorizing tasks using the IScanner object supplied by GetScanner.

The base method always returns a new Colorizer object that is initialized with an IScanner object obtained from GetScanner. This method is called whenever a new Source object is created.

Applies to

GetColorizer(IVsTextLines, IVsColorizer)

Returns the colorizer associated with a Source object that contains the given IVsTextLines object.

public:
 virtual int GetColorizer(Microsoft::VisualStudio::TextManager::Interop::IVsTextLines ^ buffer, [Runtime::InteropServices::Out] Microsoft::VisualStudio::TextManager::Interop::IVsColorizer ^ % result);
public:
 int GetColorizer(Microsoft::VisualStudio::TextManager::Interop::IVsTextLines ^ buffer, [Runtime::InteropServices::Out] Microsoft::VisualStudio::TextManager::Interop::IVsColorizer ^ &  result);
int GetColorizer(Microsoft::VisualStudio::TextManager::Interop::IVsTextLines const & buffer, [Runtime::InteropServices::Out] Microsoft::VisualStudio::TextManager::Interop::IVsColorizer const & & result);
public int GetColorizer (Microsoft.VisualStudio.TextManager.Interop.IVsTextLines buffer, out Microsoft.VisualStudio.TextManager.Interop.IVsColorizer result);
abstract member GetColorizer : Microsoft.VisualStudio.TextManager.Interop.IVsTextLines * IVsColorizer -> int
override this.GetColorizer : Microsoft.VisualStudio.TextManager.Interop.IVsTextLines * IVsColorizer -> int
Public Function GetColorizer (buffer As IVsTextLines, ByRef result As IVsColorizer) As Integer

Parameters

buffer
IVsTextLines

[in] An IVsTextLines object representing the buffer of text to colorize.

result
IVsColorizer

[out] An IVsColorizer object representing the colorizer.

Returns

If successful, returns S_OK; otherwise, returns an error code.

Implements

Remarks

The base method returns the existing Source object that contains the IVsTextLines object or creates a new Source object for the IVsTextLines object, and then asks the Source object for its colorizer. The Colorizer class implements the IVsColorizer interface.

Applies to