How to use the gdtoolkit.formatter.expression_utils.is_trailing_comma function in gdtoolkit

To help you get started, we’ve selected a few gdtoolkit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Scony / godot-gdscript-toolkit / gdtoolkit / formatter / expression.py View on Github external
),
                ),
                (
                    a_list[-1].end_line,
                    "{}{}".format(
                        context.indent_string, expression_context.suffix_string
                    ),
                ),
            ]
    formatted_lines = [
        (
            expression_context.prefix_line,
            "{}{}".format(context.indent_string, expression_context.prefix_string),
        )
    ]  # type: FormattedLines
    trailing_comma_present = is_trailing_comma(a_list[-1])
    for i, element in enumerate(elements):
        suffix = "," if i != len(elements) - 1 or trailing_comma_present else ""
        child_expression_context = ExpressionContext("", element.line, suffix)
        lines, _ = _format_standalone_expression(
            element, child_expression_context, child_context
        )
        formatted_lines += lines
    formatted_lines.append(
        (
            expression_context.suffix_line
            if expression_context.suffix_line is not None
            else a_list[-1].end_line,
            "{}{}".format(context.indent_string, expression_context.suffix_string),
        )
    )
    return formatted_lines