Exemplo n.º 1
0
        public RichTextBlock GetElementDescription(IDeclaredElement element, DeclaredElementDescriptionStyle style,
                                                   PsiLanguageType language, IPsiModule module = null)
        {
            if (!element.IsFromUnityProject())
            {
                return(null);
            }

            var method = element as IMethod;

            if (method != null)
            {
                var message = myUnityApi.GetUnityMessage(method);
                if (message?.Description != null)
                {
                    return(new RichTextBlock(message.Description));
                }
            }

            var parameter = element as IParameter;
            var owner     = parameter?.ContainingParametersOwner as IMethod;

            if (owner != null)
            {
                var message          = myUnityApi.GetUnityMessage(owner);
                var messageParameter = message?.GetParameter(parameter.ShortName);
                if (messageParameter?.Description != null)
                {
                    return(new RichTextBlock(messageParameter.Description));
                }
            }

            return(null);
        }
        private UnityMessage GetMessage(IDeclaredElement declaredElement)
        {
            var method = declaredElement as IMethod;

            return(method != null?myUnityApi.GetUnityMessage(method) : null);
        }