コード例 #1
0
        string GetParameterTooltip(int parameterNumber)
        {
            DndFunction dndFunction = TextCompletionEngine.GetActiveDndFunction(TextEditor.TextArea);

            if (dndFunction == null)
            {
                return(null);
            }

            IEnumerable <ParamAttribute> customAttributes = dndFunction.GetType().GetCustomAttributes(typeof(ParamAttribute)).Cast <ParamAttribute>().ToList();

            if (customAttributes == null)
            {
                return(null);
            }

            ParamAttribute paramAttribute = customAttributes.FirstOrDefault(x => x.Index == parameterNumber);

            if (paramAttribute == null)
            {
                return(null);
            }

            return(paramAttribute.Description);
        }
コード例 #2
0
        public FunctionCompletionData(DndFunction function)
        {
            Function = function;
            Text     = function.Name;
            TooltipAttribute tooltipAttribute = function.GetType().GetCustomAttribute <TooltipAttribute>();

            if (tooltipAttribute != null)
            {
                ToolTip = tooltipAttribute.DisplayText;
            }
        }
コード例 #3
0
        EditorProviderDetails GetCompletionProviderDetails()
        {
            EditorProviderDetails result = new EditorProviderDetails();

            DndFunction dndFunction = GetActiveDndFunction(TbxCode.TextArea);

            if (dndFunction != null)
            {
                result.ActiveMethodCall = dndFunction.Name;
                IEnumerable <ParamAttribute> customAttributes = dndFunction.GetType().GetCustomAttributes(typeof(ParamAttribute)).Cast <ParamAttribute>().ToList();
                if (customAttributes != null)
                {
                    int            parameterNumber = TbxCode.Document.GetParameterNumberAtPosition(TbxCode.CaretOffset);
                    ParamAttribute paramAttribute  = customAttributes.FirstOrDefault(x => x.Index == parameterNumber);
                    if (paramAttribute != null)
                    {
                        result.Name = paramAttribute.Editor;
                        result.Type = paramAttribute.Type;
                    }
                }
            }
            return(result);
        }