CppSharp icon indicating copy to clipboard operation
CppSharp copied to clipboard

Duplicate <summary> in inline comments while rewriting XML comments in C++

Open baremetaldude opened this issue 9 years ago • 3 comments

Brief Description

Duplicate

while rewriting XML comments in C++

C++:

/// <summary>text</summary>
enum_element = 0,

C#:

/// <summary><summary>text</summary></summary>
enum_element = 0,

Need to modify GenerateInlineSummary to something like:

if( comment.BriefText.StartsWith( "<summary>" ) && comment.BriefText.EndsWith( "</summary>" ) )
					WriteLine("{0} {1}", Options.CommentPrefix, comment.BriefText);
				else
					WriteLine( "{0} <summary>{1}</summary>", Options.CommentPrefix, comment.BriefText);

Ideally it should be able to parse C++ XML comments and rewrite(?) it to C# XML comments

OS: Windows / OS X / Linux (include version and/or distro)

Used headers
Used settings

Target: MSVC/GCC/Clang

Other settings

Stack trace or incompilable generated code

baremetaldude avatar Feb 14 '17 23:02 baremetaldude

I believe @Oceanswave had a similar issue and developed a custom pass that deals with it.

https://github.com/BaristaLabs/ChakraSharp/blob/master/ChakraSharp/FixCommentsPass.cs

We'd like to see this integrated back into C++#, we can integrate it as an official pass if someone sends a PR (if possible with a test case, should be easy, just extend the one in tests, like Common).

tritao avatar Feb 14 '17 23:02 tritao

Should I simply duplicate @Oceanswave 's code for this? Or even if I write it again, it will look fairly similar to his since I have read it now >_< ... OR is the solution in the asker's comment acceptable?

genuinelucifer avatar Feb 17 '17 17:02 genuinelucifer

The license of the code is compatible so I think we can take and improve the linked code.

tritao avatar Feb 17 '17 17:02 tritao