Share via


IColorSink Interface

Provides colorization information for colorizing a line.

IColorSink : IDispatch

Methods in Vtable Order

The following table shows the methods of this interface.

Method

Description

IColorSink::Colorize Method

Sets the color classes for a range of characters in a line.

Remarks

An implementation of the IBabelService::ColorLine Method tokenizes the given line of text and calls the IColorSink::Colorize Method for each token found. It is recommended that all calls to the Colorize method provide information for every character in the original text line, including spaces.

The typical sequence of calls for colorizing a line of text (using the default Babel implementation) looks like the following. Note that the default Babel colorizer class implements both the IVsColorizer interface and the IColorSink Interface.

  1. The ColorizeLine method in the IVsColorizer interface is called by Visual Studio with text to colorize.

  2. The ColorizeLine method saves the pointer to the attribute list.

  3. The ColorizeLine method calls the IBabelService::ColorLine Method method with the line to parse and a pointer to itself cast as the IColorSink interface.

  4. The IBabelService::ColorLine method parses the line into tokens.

  5. The IBabelService::ColorLine method calls the IColorSink::Colorize Method method for each token, using the supplied IColorSink object.

Notes for Implementers

This interface should be implemented on the same class that implements the IVsColorizer interface. The ColorizeLine method in the IVsColorizer interface receives the text to be colorized as well as the array to fill in for each character in the text. The array is cached and the text is forwarded on to the language service for processing (by calling the IBabelService::ColorLine Method, supplying the text and the IColorSink object to use). The ColorLine method calls the IColorSink::Colorize Method for each token that has been parsed. If you use the default Babel implementation, you do not need to implement the IColorSink interface.

Notes for Callers

Call this interface to set colorization information for a given line of text as given to the IBabelService::ColorLine Method method.

Requirements

Header: BabelService.idl

See Also

Concepts

The Default Babel Implementation in the Language Service Package

Reference

IBabelService Interface

IBabelService::ColorLine Method