dotnet/roslyn

SyntaxGenerator removes DisabledTextTrivia even with "KeepDirectives" is specified

Open

#21.122 aperta il 25 lug 2017

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)C# (4257 fork)batch import
Area-IDEBughelp wanted

Metriche repository

Star
 (20.414 star)
Metriche merge PR
 (Merge medio 6g 17h) (256 PR mergiate in 30 g)

Descrizione

Consider the following code:

#if SomethingNotSet
    this is disabled code
#endif

    SomeCode();

If you use SyntaxGenerator to remove the "SomeCode();" statement and you specify that you want to keep leading directives, you get the following:

#if SomethingNotSet
#endif

This seems pretty broken. Keeping directives is so that the directives will not be touched and the code will retain its meaning. Here though we remove the DisabledText breaking the intent.

Guida contributor