# Path: src/cfml_plugins.py
# def _plugin_loaded():


import sublime
from ..cfml_plugins import basecompletions


def format_properties(cfml_format):
    sort_by = cfml_format.get_setting("format_properties.sort_by")

    if sort_by != "name":
        return []

    properties = cfml_format.find_by_selector(
        "source.cfml.script meta.tag.property.cfml"
    )
    property_names = cfml_format.find_by_selector(
        "source.cfml.script meta.tag.property.name.cfml"
    )

    if len(properties) != len(property_names):
        return

    sorted_properties = [
        r
        for r, name in sorted(
            zip(properties, property_names), key=lambda x: cfml_format.view.substr(x[1])
        )
    ]
    replacements = [

# Path: src/cfml_plugins.py
# def _plugin_loaded():


# Path: src/formatting/misc.py
import sublime
from ..cfml_plugins import basecompletions



def format_properties(cfml_format):
    sort_by = cfml_format.get_setting("format_properties.sort_by")

    if sort_by != "name":
        return []

    properties = cfml_format.find_by_selector(
        "source.cfml.script meta.tag.property.cfml"
    )
    property_names = cfml_format.find_by_selector(
        "source.cfml.script meta.tag.property.name.cfml"
    )

    if len(properties) != len(property_names):
        return

    sorted_properties = [
        r
        for r, name in sorted(
            zip(properties, property_names), key=lambda x: cfml_format.view.substr(x[1])
        )
    ]
    replacements = [

        (r, cfml_format.view.substr(sorted_r))