14

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: enter image description here

Jarlaxle
  • 871
  • 10
  • 18
  • 1
    I hope you don't have that code -- it will legitimately generate complaints from doxygen that your documentation doesn't match the actual parameter names in the source code. Beyond that, "the first argument" is not what should be in your documentation. – Ben Voigt Jul 24 '10 at 16:04
  • This is just non-accurate copy-past from Doxygen documentation. Thanks :) – Jarlaxle Jul 24 '10 at 16:20
  • What type of highlighting do you want? I'm throwing together a sample/extension that does it, but some more information would be helpful. – Noah Richards Jul 24 '10 at 18:47
  • Here you can see it: http://yfrog.com/3ddoxygenp – Jarlaxle Jul 25 '10 at 13:44
  • That looks sweet! Nicely done. If you haven't yet, you should put up a version on the [Visual Studio Gallery](http://visualstudiogallery.msdn.microsoft.com/) so other people can use this, too. – Noah Richards Jul 25 '10 at 16:15
  • Current version is not ready for everybody use. For example, it highlights Doxygen commands everywhere. I should limit it to Doxygen-style comments only. – Jarlaxle Jul 26 '10 at 06:28
  • I tried your extension in Visual Studio 2010, but it only works with `///` comment blocks. It doesn't work with `/*`, `/*!`, or `/**` comment blocks. – Emile Cormier Mar 08 '13 at 22:26
  • Nevermind, it seems to work now. Maybe I had forgotten to restart VS. Great extension! – Emile Cormier Mar 10 '13 at 20:21
  • are you planning to make it available on vs2015? – jungle_mole Dec 23 '15 at 08:31
  • Download link does not work. And > Project is seeking maintainer. – kyb Nov 23 '16 at 13:19
  • VS2015 support wanted. Please post this work on GitHub for collaborative development and update. I'd like to participate. – kyb Nov 23 '16 at 13:22
  • You can find sources on Bitbucket: https://bitbucket.org/manenko/doxygencomments/src – Jarlaxle Dec 04 '16 at 08:27

2 Answers2

3

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.

Puppy
  • 144,682
  • 38
  • 256
  • 465
  • 1
    I had finished the basic Visual Studio Extension for syntax highlighting of Doxygen commands. Thank you for the hint! :0) Anyway it very basic (I can improve it, but this will be waste of time) so I prefer to find something more usable :) – Jarlaxle Jul 24 '10 at 22:21
0

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:

Example highlighting for light and dark themes

Sedenion
  • 5,421
  • 2
  • 14
  • 42