Example #1
0
        /// <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());
        }
Example #2
0
        public LuatVariable CreateReflectedVariable(string strTypeName, LuatValue parent)
        {
            foreach (ReflectedTypeResolver resolver in m_reflectedTypeResolvers)
            {
                LuatVariable variable;
                if (resolver(strTypeName, parent, out variable))
                {
                    return(variable);
                }
            }

            return(new LuatVariable(parent, new LuatTypeReflected(strTypeName), LuatVariableFlags.FixedType));
        }
Example #3
0
        // Attempts to index the given variable by examining the assigned values
        public override LuatValue Index(string index, bool bAssignment, ref HashSet <LuatValue> visited)
        {
            visited.Add(this);

            foreach (LuatValue value in ValueAssignments)
            {
                if (visited.Contains(value))
                {
                    continue;
                }

                LuatValue var = value.Index(index, bAssignment, ref visited);
                if (null != var)
                {
                    return(var);
                }
            }

            return(null);
        }
Example #4
0
        // Removes an item from the table by value
        public void RemoveChild(LuatValue value)
        {
            var names = new List <string>();

            foreach (KeyValuePair <string, LuatValue> child in m_children)
            {
                if (child.Value == value)
                {
                    names.Add(child.Key);
                }
            }

            if (names.Count == 0)
            {
                throw new Exception("Child not found");
            }

            foreach (string name in names)
            {
                m_children.Remove(name);
            }
        }
Example #5
0
 public AutoCompleteItem(string name, LuatValue value)
 {
     Name        = name;
     Description = value.Description;
     Icon        = value.Type.Icon;
 }
Example #6
0
 public void AddAlias(string name, LuatValue value)
 {
     Metatable.CreateIndex();
     Metatable.Index.AddChild(name, value);
 }
Example #7
0
 public LuatTable(LuatValue parent)
     : base(parent)
 {
 }
Example #8
0
 public LuatVariable(LuatValue parent, LuatType type, LuatVariableFlags flags)
     : base(parent)
 {
     m_flags = flags;
     m_type  = type;
 }
Example #9
0
 public LuatVariable(LuatValue parent, LuatVariableFlags flags)
     : base(parent)
 {
     m_flags = flags;
 }
Example #10
0
 public LuatFunction(LuatValue returnValue, string[] arguments)
     : base(null)
 {
     m_type      = new LuatTypeFunction(arguments);
     ReturnValue = returnValue;
 }
Example #11
0
 protected LuatValue(LuatValue parent)
 {
     Parent = parent;
 }