vscode-csharp
vscode-csharp copied to clipboard
Documentation popup doesn't display C# XML documentation properly
C# XML doc comments don't get rendered as they deserved by VsCode's inline doc popup. Namely:
- The Examples section is missing;
- The See Also section is missing;
- The exceptions are listed, but without documentation;
- Lists are poorly displayed;
- Tables are poorly — let's stay polite — displayed;
- The generic type parameter in the inline code snippets is missing (see below);
- Inline code snippets are not rendered in monospace font;
- Code snippets are not highlighted;
Code
class Example {
/**
<summary>
<para>
This is a summary paragraph.
</para>
<para>
This is another summary paragraph.
</para>
</summary>
<remarks>
<para>
This is a remark paragraph.
</para>
<para>
Let's now make a simple list:
</para>
<list type="bullet">
<item>One</item>
<item>Two</item>
<item>Three</item>
</list>
<para>
Let's now make a paragraph list:
</para>
<list type="bullet">
<item>
<para>
This is a one paragraph.
</para>
</item>
<item>
<para>
This is a two paragraph.
</para>
</item>
<item>
<para>
This is a three paragraph.
</para>
</item>
</list>
<para>
Let's now make a definition list:
</para>
<list type="bullet">
<item>
<term>One</term>
<description>The first term defined.</description>
</item>
<item>
<term>Two</term>
<description>The second term defined.</description>
</item>
<item>
<term>Three</term>
<description>
<para>
The third term defined.
</para>
<para>
This one is defined over two paragraphs.
</para>
</description>
</item>
</list>
<para>
There are also number lists:
</para>
<list type="number">
<item>One</item>
<item>Two</item>
<item>Three</item>
</list>
<para>
There are also table lists:
</para>
<list type="table">
<listheader>
<term>Action</term>
<term>Description</term>
<term>Power Consumption</term>
</listheader>
<item>
<term>Forward</term>
<term>Move forwards in a straight line.</term>
<term>50W</term>
</item>
<item>
<term>Backward</term>
<term>Move backwards in a straight line.</term>
<term>50W</term>
</item>
<item>
<term>RotateLeft</term>
<term>Rotate to the left.</term>
<term>30W</term>
</item>
<item>
<term>RotateRight</term>
<term>Rotate to the right.</term>
<term>30W</term>
</item>
<item>
<term>Dig</term>
<term>Tells the robot to dig and obtain a soil sample.</term>
<term>800W</term>
</item>
</list>
<para>
Let's also use with some inline <c>new Example().Sample<int>(0);</c> code.
</para>
</remarks>
<typeparam name="T">
<para>
This is a T paragraph.
The type refers to the type of the parameter <paramref name="x"/>.
</para>
</typeparam>
<param name="x">
<para>
This is a parameter paragraph.
</para>
</param>
<returns>
<para>
This is a return paragraph.
</para>
</returns>
<exception cref="ArgumentException">
<para>
This is an exception paragraph.
</para>
</exception>
<exception cref="DllNotFoundException">
<para>
This is another exception paragraph.
</para>
</exception>
<example>
<para>
Let's also use with some block code:
</para>
<code>
int f() {
return new Example().Sample<int>(0);
}
</code>
</example>
<example>
<para>
Another example, this one is escaped with CDATA:
</para>
<code><![CDATA[
int f() {
var a = new Example();
var b = a.Sample<int>(0);
return b;
}
]]></code>
</example>
<seealso cref="Example"/>
**/
public int Sample<T>(T x) => 0;
}
Expected
This is a summary paragraph.
This is another summary paragraph.
Returns
This is a return paragraph.
Exceptions
ArgumentException
This is an exception paragraph.
DllNotFoundException
This is another exception paragraph.
Remarks
This is a remark paragraph.
Let's now make a simple list:
- One
- Two
- Three
Let's now make a paragraph list:
This is a one paragraph.
This is a two paragraph.
This is a three paragraph.
Let's now make a definition list:
- One
- The first term defined.
- Two
- The second term defined.
- Three
The third term defined.
This one is defined over two paragraphs.
There are also number lists:
- One
- Two
- Three
There are also table lists:
Action Description Power Consumption Forward Move forwards in a straight line. 50W Backward Move backwards in a straight line. 50W RotateLeft Rotate to the left. 30W RotateRight Rotate to the right. 30W Dig Tells the robot to dig and obtain a soil sample. 800W Let's also use with some inline
new Example().Sample<int>(0);code.Examples
Let's also use with some block code:
int f() { return new Example().Sample<int>(0); }Another example:
int f() { var a = new Example(); var b = a.Sample<int>(0); return b; }See Also
Example
Actual
This is a summary paragraph.
This is another summary paragraph.
This is a remark paragraph.
Let's now make a simple list:
One
Two
Three
Let's now make a paragraph list:
This is a one paragraph.
This is a two paragraph.
This is a three paragraph.
Let's now make a definition list:
One – The first term defined.
Two – The second term defined.
Three –
The third term defined.
This one is defined over two paragraphs.There are also number lists:
One
Two
Three
There are also table lists:
Action – Description – Power Consumption –
Forward – Move forwards in a straight line. – 50W –
Backward – Move backwards in a straight line. – 50W –
RotateLeft – Rotate to the left. – 30W –
RotateRight – Rotate to the right. – 30W –
Dig – Tells the robot to dig and obtain a soil sample. – 800W –
Let's also use with some inline new Example().Sample(0); code.
Returns:
This is a return paragraph.
Exceptions:
ArgumentException
DllNotFoundException
I'm using "csharp.semanticHighlighting.enabled": true
VsCode 1.77.3, commit 704ed70d4fd1c6bd6342c436f1ede30d1cff4710
C# extension 1.25.4
See also #3884
The <code> is not working, too (https://github.com/OmniSharp/omnisharp-vscode/issues/5130).
Agreed, The <code> only works if placed inside <summary>, and even that has a lot of weird backslashes.
Here's my case :
/// <summary>Value-type enumerator for traversing a <see cref="Coord3D"/> row-first
/// <code>
/// // Equivalent to the following nested loops
/// for(Coord3D c = offset; c.d2 < offset.d2 + size.d2; c.d2++) {
/// for(c.d1 = offset.d1; c.d1 < offset.d1 + size.d1; c.d1++) {
/// for(c.d0 = offset.d0; c.d0 < offset.d0 + size.d0; c.d0++) {
/// yield return c;
/// }
/// }
/// }
/// </code>
/// </summary>
public struct Coord3DRowMajorCubeIterator : IEnumerator<Coord3D> { /* bla bla bla */ }
And here's how it shows :
Would love to see this improved, bumping this