Beispiel #1
0
        public static string OwnerNamespaceDeclaration(this ITypeElement element)
        {
            INamespace containingNamespace = element.GetContainingNamespace();
            var        list = new List <string>();

            for (; !containingNamespace.IsRootNamespace; containingNamespace = containingNamespace.GetContainingNamespace())
            {
                list.Add(containingNamespace.ShortName);
            }
            list.Reverse();
            return(string.Join(".", list.ToArray()));
        }
Beispiel #2
0
        private void AppendNamespace([NotNull] INamespace ns)
        {
            var containingNamespaces = new Stack <string>();

            for (INamespace iter = ns.GetContainingNamespace(); iter != null && !iter.IsRootNamespace; iter = iter.GetContainingNamespace())
            {
                containingNamespaces.Push(iter.ShortName);
            }

            string highlighterId = _highlighterIdProvider.Namespace;

            while (containingNamespaces.Count > 0)
            {
                AppendText(containingNamespaces.Pop(), highlighterId);
                AppendText(".", _highlighterIdProvider.Operator);
            }
            AppendText(ns.ShortName, highlighterId);
        }
Beispiel #3
0
        private void AppendNamespace([NotNull] INamespace ns)
        {
            var containingNamespaces = new Stack <string>();

            for (INamespace iter = ns.GetContainingNamespace(); iter != null && !iter.IsRootNamespace; iter = iter.GetContainingNamespace())
            {
                containingNamespaces.Push(iter.ShortName);
            }

            string attributeId = _options.UseReSharperColors ? HighlightingAttributeIds.NAMESPACE_IDENTIFIER_ATTRIBUTE : null;

            while (containingNamespaces.Count > 0)
            {
                AppendText(containingNamespaces.Pop(), attributeId);
                AppendText(".", VsHighlightingAttributeIds.Operator);
            }
            AppendText(ns.ShortName, attributeId);
        }