GetCSharp() public static method

public static GetCSharp ( NameOptions option ) : NameVisitorCreator
option NameOptions
return NameVisitorCreator
Esempio n. 1
0
        public override void VisitMethod(IMethodSymbol symbol)
        {
            var id = VisitorHelper.GetId(symbol.OriginalDefinition);

            ReferenceItem.Parts[SyntaxLanguage.CSharp].Add(new LinkItem
            {
                DisplayName           = NameVisitorCreator.GetCSharp(NameOptions.WithGenericParameter).GetName(symbol),
                DisplayQualifiedNames = NameVisitorCreator.GetCSharp(NameOptions.Qualified | NameOptions.WithGenericParameter).GetName(symbol),
                Name           = id,
                IsExternalPath = symbol.IsExtern || symbol.DeclaringSyntaxReferences.Length == 0,
            });
            ReferenceItem.Parts[SyntaxLanguage.CSharp].Add(new LinkItem
            {
                DisplayName           = "(",
                DisplayQualifiedNames = "(",
            });
            for (int i = 0; i < symbol.Parameters.Length; i++)
            {
                if (i > 0)
                {
                    ReferenceItem.Parts[SyntaxLanguage.CSharp].Add(new LinkItem
                    {
                        DisplayName           = ", ",
                        DisplayQualifiedNames = ", ",
                    });
                }
                symbol.Parameters[i].Type.Accept(this);
            }
            ReferenceItem.Parts[SyntaxLanguage.CSharp].Add(new LinkItem
            {
                DisplayName           = ")",
                DisplayQualifiedNames = ")",
            });
        }
Esempio n. 2
0
        protected override void AddLinkItems(INamedTypeSymbol symbol, bool withGenericeParameter)
        {
            var id = VisitorHelper.GetId(symbol);

            if (withGenericeParameter)
            {
                ReferenceItem.Parts[SyntaxLanguage.CSharp].Add(new LinkItem
                {
                    DisplayName           = NameVisitorCreator.GetCSharp(NameOptions.WithGenericParameter).GetName(symbol),
                    DisplayNamesWithType  = NameVisitorCreator.GetCSharp(NameOptions.WithType | NameOptions.WithGenericParameter).GetName(symbol),
                    DisplayQualifiedNames = NameVisitorCreator.GetCSharp(NameOptions.Qualified | NameOptions.WithGenericParameter).GetName(symbol),
                    Name           = id,
                    IsExternalPath = symbol.IsExtern || symbol.DeclaringSyntaxReferences.Length == 0,
                });
            }
            else
            {
                ReferenceItem.Parts[SyntaxLanguage.CSharp].Add(new LinkItem
                {
                    DisplayName           = NameVisitorCreator.GetCSharp(NameOptions.None).GetName(symbol),
                    DisplayNamesWithType  = NameVisitorCreator.GetCSharp(NameOptions.WithType).GetName(symbol),
                    DisplayQualifiedNames = NameVisitorCreator.GetCSharp(NameOptions.Qualified).GetName(symbol),
                    Name           = id,
                    IsExternalPath = symbol.IsExtern || symbol.DeclaringSyntaxReferences.Length == 0,
                });
            }
        }
Esempio n. 3
0
 public override void VisitNamespace(INamespaceSymbol symbol)
 {
     ReferenceItem.Parts[SyntaxLanguage.CSharp].Add(new LinkItem
     {
         DisplayName           = NameVisitorCreator.GetCSharp(NameOptions.None).GetName(symbol),
         DisplayQualifiedNames = NameVisitorCreator.GetCSharp(NameOptions.Qualified).GetName(symbol),
     });
 }
Esempio n. 4
0
 public override void VisitNamespace(INamespaceSymbol symbol)
 {
     ReferenceItem.Parts[SyntaxLanguage.CSharp].Add(new LinkItem
     {
         DisplayName           = NameVisitorCreator.GetCSharp(NameOptions.None).GetName(symbol),
         DisplayNamesWithType  = NameVisitorCreator.GetCSharp(NameOptions.WithType).GetName(symbol),
         DisplayQualifiedNames = NameVisitorCreator.GetCSharp(NameOptions.Qualified).GetName(symbol),
         IsExternalPath        = symbol.IsExtern || symbol.DeclaringSyntaxReferences.Length == 0,
     });
 }
Esempio n. 5
0
        public override void VisitDynamicType(IDynamicTypeSymbol symbol)
        {
            var id = VisitorHelper.GetId(symbol.OriginalDefinition);

            ReferenceItem.Parts[SyntaxLanguage.CSharp].Add(new LinkItem
            {
                DisplayName           = NameVisitorCreator.GetCSharp(NameOptions.None).GetName(symbol),
                DisplayNamesWithType  = NameVisitorCreator.GetCSharp(NameOptions.WithType).GetName(symbol),
                DisplayQualifiedNames = NameVisitorCreator.GetCSharp(NameOptions.Qualified).GetName(symbol),
                Name = id,
            });
        }
Esempio n. 6
0
        public override void VisitField(IFieldSymbol symbol)
        {
            var id = VisitorHelper.GetId(symbol.OriginalDefinition);

            ReferenceItem.Parts[SyntaxLanguage.CSharp].Add(new LinkItem
            {
                DisplayName           = NameVisitorCreator.GetCSharp(NameOptions.WithGenericParameter).GetName(symbol),
                DisplayQualifiedNames = NameVisitorCreator.GetCSharp(NameOptions.Qualified | NameOptions.WithGenericParameter).GetName(symbol),
                Name           = id,
                IsExternalPath = symbol.IsExtern || symbol.DeclaringSyntaxReferences.Length == 0,
            });
        }
Esempio n. 7
0
        public override void VisitProperty(IPropertySymbol symbol)
        {
            var id = _asOverload ? VisitorHelper.GetOverloadId(symbol.OriginalDefinition) : VisitorHelper.GetId(symbol.OriginalDefinition);

            ReferenceItem.Parts[SyntaxLanguage.CSharp].Add(new LinkItem
            {
                DisplayName           = NameVisitorCreator.GetCSharp(NameOptions.WithTypeGenericParameter).GetName(symbol),
                DisplayNamesWithType  = NameVisitorCreator.GetCSharp(NameOptions.WithType | NameOptions.WithTypeGenericParameter).GetName(symbol),
                DisplayQualifiedNames = NameVisitorCreator.GetCSharp(NameOptions.Qualified | NameOptions.WithTypeGenericParameter).GetName(symbol),
                Name           = id,
                IsExternalPath = symbol.IsExtern || symbol.DeclaringSyntaxReferences.Length == 0,
            });
            if (symbol.Parameters.Length > 0 && !_asOverload)
            {
                ReferenceItem.Parts[SyntaxLanguage.CSharp].Add(new LinkItem
                {
                    DisplayName           = "[",
                    DisplayNamesWithType  = "[",
                    DisplayQualifiedNames = "[",
                });
                for (int i = 0; i < symbol.Parameters.Length; i++)
                {
                    if (i > 0)
                    {
                        ReferenceItem.Parts[SyntaxLanguage.CSharp].Add(new LinkItem
                        {
                            DisplayName           = ", ",
                            DisplayNamesWithType  = ", ",
                            DisplayQualifiedNames = ", ",
                        });
                    }
                    symbol.Parameters[i].Type.Accept(this);
                }
                ReferenceItem.Parts[SyntaxLanguage.CSharp].Add(new LinkItem
                {
                    DisplayName           = "]",
                    DisplayNamesWithType  = "]",
                    DisplayQualifiedNames = "]",
                });
            }
        }