Ejemplo n.º 1
0
        private IdentifierTooltipContent[] GetIdentifierContentsCore(
            DocumentRange documentRange, [NotNull] IContextBoundSettingsStore settings, [CanBeNull] IHighlighter highlighter)
        {
            DeclaredElementInfo info = FindDeclaredElement(documentRange);

            if (info == null)
            {
                return(EmptyArray <IdentifierTooltipContent> .Instance);
            }

            IdentifierTooltipContent standardContent = TryPresentColorized(info, settings)
                                                       ?? TryPresentNonColorized(highlighter, info.DeclaredElement, settings);

            bool replacesStandardContent;
            IdentifierTooltipContent additionalContent = TryGetAdditionalIdentifierContent(info, settings, out replacesStandardContent);

            if (replacesStandardContent)
            {
                standardContent   = additionalContent;
                additionalContent = null;
            }

            var results = new FrugalLocalList <IdentifierTooltipContent>();

            if (standardContent != null)
            {
                results.Add(standardContent);
            }
            if (additionalContent != null)
            {
                results.Add(additionalContent);
            }
            return(results.ToArray());
        }
Ejemplo n.º 2
0
        private MethodSignature[] GetSignaturesFromRequiredSignatureAttribute(ITypeElement attributeTypeElement)
        {
            var signatures = new FrugalLocalList <MethodSignature>();

            foreach (var method in attributeTypeElement.Methods)
            {
                if (method.HasAttributeInstance(KnownTypes.RequiredSignatureAttribute, AttributesSource.Self))
                {
                    var parameterTypes = new FrugalLocalList <IType>();
                    var parameterNames = new FrugalLocalList <string>();
                    foreach (var parameter in method.Parameters)
                    {
                        parameterTypes.Add(parameter.Type);
                        parameterNames.Add(parameter.ShortName);
                    }

                    signatures.Add(new MethodSignature(method.ReturnType, method.IsStatic,
                                                       parameterTypes.AsIReadOnlyList(), parameterNames.AsIReadOnlyList()));
                }
            }

            return(signatures.IsEmpty ? null : signatures.ToArray());
        }
		private IdentifierTooltipContent[] GetIdentifierContentsCore(
			DocumentRange documentRange, [NotNull] IContextBoundSettingsStore settings, [CanBeNull] IHighlighter highlighter) {

			DeclaredElementInfo info = FindDeclaredElement(documentRange);
			if (info == null)
				return EmptyArray<IdentifierTooltipContent>.Instance;

			IdentifierTooltipContent standardContent = TryPresentColorized(info, settings)
				?? TryPresentNonColorized(highlighter, info.DeclaredElement, settings);

			bool replacesStandardContent;
			IdentifierTooltipContent additionalContent = TryGetAdditionalIdentifierContent(info, settings, out replacesStandardContent);
			if (replacesStandardContent) {
				standardContent = additionalContent;
				additionalContent = null;
			}

			var results = new FrugalLocalList<IdentifierTooltipContent>();
			if (standardContent != null)
				results.Add(standardContent);
			if (additionalContent != null)
				results.Add(additionalContent);
			return results.ToArray();
		}