dotnet/roslyn

[Request] Use SymbolDisplayFormat to display modifiers and accessibility for a class, struct, interface and delegate

开放

#28,297 创建于 2018年7月5日

 (0 条评论) (2 个反应) (0 位负责人)C# (4,257 个派生)batch import
Area-CompilersConcept-APIFeature Requesthelp wanted

仓库指标

星标
 (20,414 个星标)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 256 个 PR)

描述

I would like to display class symbol similar how it is displayed on docs.microsoft.com.

For example if I have public static generic class with a constraint I would like to get:

public static class Foo<T> where T : Bar

But with current SymbolDisplayFormat I can get only:

class Foo<T> where T : Bar

There are options:

  • SymbolDisplayMemberOptions.IncludeModifiers
  • SymbolDisplayMemberOptions.IncludeAccessibility

but they are not applicable for a type declaration.

So I would propose to add a new options such as:

[Flags]
public enum SymbolDisplayTypeDeclarationOptions
{
  None = 0,
  IncludeModifiers = 1,
  IncludeAccessibility = 2
}

or extend SymbolDisplayMiscellaneousOptions.

贡献者指南