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); }
public FunctionCompletionData(DndFunction function) { Function = function; Text = function.Name; TooltipAttribute tooltipAttribute = function.GetType().GetCustomAttribute <TooltipAttribute>(); if (tooltipAttribute != null) { ToolTip = tooltipAttribute.DisplayText; } }
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); }