/// <summary>
        /// Gets the formatted text to display in quick info for the specified function call
        /// </summary>
        private string GetQuickInfoForFunctionCall(LuatValue func, int parameterIndex)
        {
            var functionType = func.Type as LuatTypeFunction;

            var sb = new StringBuilder();

            sb.Append("<img src=\"resource:PublicMethod\" align=\"absbottom\"/> ");
            sb.Append("<span style=\"color: blue;\">function</span> ");
            // sb.Append(String.Format("<span style=\"color: teal;\">{0}</span>", IntelliPrompt.EscapeMarkupText(functionDeclaration.Name.Text)));
            sb.Append("(");
            string[] parameters = functionType == null ? new string[0] : functionType.Arguments;
            for (int index = 0; index < parameters.Length; index++)
            {
                if (index > 0)
                {
                    sb.Append(", ");
                }
                if (parameterIndex == index)
                {
                    sb.Append("<b>");
                }
                sb.Append(IntelliPrompt.EscapeMarkupText(parameters[index]));
                if (parameterIndex == index)
                {
                    sb.Append("</b>");
                }
            }
            sb.Append(")<br/>");
            sb.Append(FormatText(func.Description));
            return(sb.ToString());
        }
Beispiel #2
0
 private string BulletizeAndEscape(string s)
 {
     if (!s.Contains <char>('\n'))
     {
         return(IntelliPrompt.EscapeMarkupText(s));
     }
     string[] strArray = (from line in s.Split(new char[] { '\n' }) select "• " + IntelliPrompt.EscapeMarkupText(line)).ToArray <string>();
     return(string.Join("<span style=\"font-size:3pt\"><br />&nbsp;<br /></span>", strArray));
 }
Beispiel #3
0
        private string GetGlobalDescription(Global g)
        {
            StringBuilder description = new StringBuilder();

            description.Append(GetFormattedTypeString(g.Type) + " ");
            description.Append("<strong>" + g.Name + "</strong>");
            if (g.Description != String.Empty)
            {
                description.Append("<br /><span style=\"color: #008800\">" + IntelliPrompt.EscapeMarkupText(g.Description) + "</span>");
            }

            bool get = true;
            bool set = true;

            if (g.IsProperty)
            {
                get = g.GetAccessor != null;
                set = g.SetAccessor != null;
            }

            description.Append("<br /><span style=\"font-size: 7.5pt\">Supports: <span style=\"color: #0000FF\">" + (get ? "get</span>; " : "") + (set ? (get ? "<span style=\"color: #0000FF\">set" : "set") : "") + "</span>;</span>");

            return(description.ToString());
        }
Beispiel #4
0
        private string GetFunctionDescription(Function f, int index)
        {
            string overloadIndicator = String.Empty;

            if (index == -1)
            {
                index = 0;
                if (f.Overloads.Length > 1)
                {
                    overloadIndicator = String.Format("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #888888; font-size: 7.5pt\">(+{0} overloads)</span>", f.Overloads.Length - 1);
                }
            }

            InternalFunction iF = f.Overloads[index];

            StringBuilder description = new StringBuilder();

            description.Append(GetFormattedTypeString(iF.ReturnType) + " ");
            description.Append("<strong>" + f.Name + "</strong>(");
            for (int i = 0; i < iF.Arguments.Length; i++)
            {
                description.Append(GetFormattedTypeString(iF.Arguments[i].Type));
                if (iF.Arguments[i].Name != String.Empty)
                {
                    description.Append(" " + iF.Arguments[i].Name);
                }
                if (i != iF.Arguments.Length - 1)
                {
                    description.Append(", ");
                }
            }
            description.Append(")" + overloadIndicator + "<br /><span style=\"color: #008800\">" + IntelliPrompt.EscapeMarkupText(iF.Description) + "</span>");

            return(description.ToString());
        }
Beispiel #5
0
 private void HandleUnloaded(object sender, RoutedEventArgs e)
 {
     IntelliPrompt.CloseAllSessions();
 }