简体   繁体   中英

Visual Studio: Syntax highlighting for Doxygen-style C++ comments

I want enchanted syntax coloring in comments for C++ language in Visual Studio 2010. For example, I have the following code:

/*!
      \sa testMeToo()
      \param a the first argument.
      \param s the second argument.
*/
int testMe(int a,const char *s);

In Visual Studio all \param , \sa and other Doxygen commands are not highlighted. Is it possible to add custom highlighting to Visual Studio?

As for me ideal syntax highlighting for such C++ comments is in Anjuta (GNU/Linux C++ IDE).

Thanks.

UPDATE

I wrote EnhancedCommentsCpp addon for Visual Studio 2010/2012 that highlights Doxygen commands:

http://visualstudiogallery.msdn.microsoft.com/11a30c1c-593b-4399-a702-f23a56dd8548

This is how it looks like:在此处输入图像描述

You can use Visual Studio Extensibility to add custom syntax highlighting. You'll have to check MSDN and the Visual Studio Extensibility SDK to find out how though.

Since there were no maintained extensions available for recent Visual Studio versions for quite some time now that implement syntax highlighting of Doxygen comments, I wrote one: VSDoxyHighlighter is available on the Visual Studio marketplace and on github .

The extension currently supports Visual Studio 2022 and the highlighting can be enabled/disabled separately for // , /// , //! , /* , /** and /*! comments. It also comes with two default color sets, one for dark and one for light VS themes:

浅色和深色主题的突出显示示例

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM