                             if result_regex isnt null
                                 element.type = 'anonymous_function'
                                 list_args = result_regex[2]?.split(',')
-                                element.args = list_args
+                                element.args = []
                                 new_context = DataUtils.deep_copy context
                                 for arg in list_args
                                     arg = arg.replace(/(^\s*)|(\s*$)/gi,"") # Removing leading/trailing spaces
                                     new_context[arg] = true
+                                    element.args.push arg
                                 element.context = new_context
                                 to_skip = result_regex[0].length
                                 body_start = i+result_regex[0].length

                            # Check for a standard method
                            result_regex = @regex.method.exec query.slice new_start
                            if result_regex isnt null
                                if stack[stack.length-1]?.type is 'function' or stack[stack.length-1]?.type is 'var' # We want the query to start with r. or arg.
                                    element.type = 'function'
                                    element.name = result_regex[0]
                                    element.position = position+new_start
                                    start += new_start-i
                                    to_skip = result_regex[0].length-1+new_start-i
                                    stack_stop_char = ['(']
                                    continue
                                else
                                    position_opening_parenthesis = result_regex[0].indexOf('(')
                                    if position_opening_parenthesis isnt -1 and result_regex[0].slice(0, position_opening_parenthesis) of context
                                        # Save the var
                                        element.real_type = 'json'
                                        element.type = 'var'
                                        element.name = result_regex[0].slice(0, position_opening_parenthesis)
                                        stack.push element
                                        size_stack++
                                        if size_stack > @max_size_stack
                                            return null
                                        element =
                                            type: 'function'
                                            name: '('
                                            position: position+position_opening_parenthesis+1
                                            context: context
                                            complete: 'false'
                                        stack_stop_char = ['(']
                                        start = position_opening_parenthesis
                                        to_skip = result_regex[0].length-1
                                        continue

                            # Check for method without parenthesis r., r.row., doc.
                            result_regex = @regex.method_var.exec query.slice new_start
                            if result_regex isnt null
                                if result_regex[0].slice(0, result_regex[0].length-1) of context
                                    element.type = 'var'
                                    element.real_type = 'json'
                                else
                                    element.type = 'function'
                                element.position = position+new_start
                                element.name = result_regex[0].slice(0, result_regex[0].length-1).replace(/\s/, '')
                                start += new_start-i
                                element.complete = true
                                to_skip = element.name.length-1+new_start-i
                                stack.push element

                stack: stack
                query: query_before_cursor
                result: result
            result.suggestions = @uniq result.suggestions

            if result.suggestions?.length > 0
                for suggestion, i in result.suggestions
