Share via


IBabelService::GetCommentFormat Method

Used for commenting and uncommenting selected text.

HRESULT GetCommentFormat ( 
   BSTR* lineStart,
   BSTR* blockStart,
   BSTR* blockEnd,
   VARIANT_BOOL* useLineComments
);

Parameters

  • lineStart
    [out] Returns a string of characters used to start line comments (for example, "//").

  • blockStart
    [out] Returns a string of characters used to start block comments (for example, "/*").

  • blockEnd
    [out] Returns a string of characters used to end block comments (for example, "*/").

  • useLineComments
    [out] Returns whether line comments are preferred in instances where both types of comments are possible. If non-zero (TRUE), line comments are preferred. If zero (FALSE), block comments are preferred.

Return Value

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

This method is called to get information to support commenting and uncommenting code.

The Default Babel Implementation in the Language Service Package classes, the StdService class implementation of this method calls the getCommentFormat method which can be overridden in your language service class to return a CommentFormat structure that contains the information about comment formats for your language. By default, the StdService class returns NULL from the getCommentFormat method indicating there is no support for commenting and uncommenting code. The CommentFormat structure is defined in the Babel\Common\stdservice.h file. See Enable Block Commenting for more details.

See Also

Tasks

Enable Block Commenting

Reference

IBabelService Interface