dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.07k stars 4.04k forks source link

VS2022 intellisense removes whitespace when using <inheritdoc> #66719

Open vsfeedback opened 1 year ago

vsfeedback commented 1 year ago

This issue has been moved from a ticket on Developer Community.


[severity:It bothers me. A fix would be nice]
Take the following code:

/// <summary><see langword="true"/> <see langword="false"/> perhaps</summary>
public bool Foo { get; }

/// <inheritdoc cref="Foo"/>
public bool Bar { get; }
  1. Hovering Foo, intellisense describes it as “true false perhaps” (with true and false coloured blue) - exactly as expected.
  2. Hovering Bar, intellisense describes it as “truefalse perhaps” (with true and false coloured blue) - with the whitespace between the two sub-elements removed, but not between sub-elements and regular text (or between words in regular text). This applies for all combinations of sub-elements I’ve tried, such as etc.

Original Comments

Feedback Bot on 2/2/2023, 09:06 PM:

(private comment, text removed)


Original Solutions

Erik Westberg solved on 2/5/2023, 09:00 PM, 0 votes:

A non-breaking space can be used between elements to force a whitespace. “&_#_160;” without the underscores.

Eagle3386 commented 3 weeks ago

When this gets fixed, the general XML syntax violation of skipping to insert a single whitespace between " and / should be fixed, too. That's because <see cref="IFoo"/> is nothing but incorrect XML syntax & must be written as <see cref="IFoo" />

CyrusNajmabadi commented 3 weeks ago

That's because <see cref="IFoo"/> is nothing but incorrect XML

Why is that the case?

CyrusNajmabadi commented 3 weeks ago

Looking at the spec: https://www.w3.org/TR/xml/#sec-starttags

Tags for Empty Elements [44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>' [WFC: Unique Att Spec]

Empty-element tags may be used for any element which has no content, whether or not it is declared using the keyword EMPTY

This states that optional spaces are legal at the end. An example is even given for this:

Image

Eagle3386 commented 3 weeks ago

@CyrusNajmabadi Yes, I was mislead by my personal background of XHTML where - back in the days - <br /> & only that notation was allowed. Forgive me. But still, it'll be nice if VS supported those preferring <br /> instead of <br/>.

CyrusNajmabadi commented 3 weeks ago

But still, it'll be nice if VS supported those preferring

Def file a suggestion. It seems out of scope of this issue. Thanks :)

Eagle3386 commented 3 weeks ago

@CyrusNajmabadi Sorry for asking that much questions, but what does "Def file a suggestion" mean? That "Def" confuses me here.. 😞

Besides, this issue right here shouldn't be closed - the OP had at least half a different topic regarding dropped whitespace in the IntelliSense's popup.. 😉

CyrusNajmabadi commented 3 weeks ago

Sorry, i use "def" to mean "definitely" :)

CyrusNajmabadi commented 3 weeks ago

reactivating. i clicked on the wrong button. thanks :)