dotnet/roslyn

SyntaxGenerator removes DisabledTextTrivia even with "KeepDirectives" is specified

開放

#21,122 建立於 2017年7月25日

 (1 則留言) (0 個反應) (0 位負責人)C# (4,257 個分叉)batch import
Area-IDEBughelp wanted

倉庫指標

星標
 (20,414 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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.

貢獻者指南