def defineClass(text, _node):
    commands = _node.words()
    class_index = commands.index("class")
    modifiers_string = getModifiers(commands[:class_index])
    formatted_class_name = ""
    if text:
        format_me = str(text)
        if len(commands) > class_index + 1:
            format_command = commands[class_index + 1]
            if (format_command != "camel") and (format_command !="snake"):
                format_command = "pascal"  # default
            formatted_class_name = utils.text_to_case(format_command, format_me)
    (Text(modifiers_string + "class " + formatted_class_name + " {") + Key("enter")).execute()
def defineMethod(text, _node):
    commands = _node.words()
    method_index = commands.index("method")
    modifiers_string = getModifiers(commands[:method_index])
    formatted_class_name = ""
    if text:
        format_me = str(text)
        if len(commands) > method_index + 1:
            format_command = commands[method_index + 1]
            if (format_command != "pascal") and (format_command !="snake"):
                format_command = "camel"  # default
            formatted_class_name = utils.text_to_case(format_command, format_me)
    (Text(modifiers_string + formatted_class_name + "() {") + Key("enter, up, end, left:3")).execute()
def defineClass(text, _node):
    commands = _node.words()
    class_index = commands.index("class")
    modifiers_string = getModifiers(commands[:class_index])
    formatted_class_name = ""
    if text:
        format_me = str(text)
        if len(commands) > class_index + 1:
            format_command = commands[class_index + 1]
            if (format_command != "camel") and (format_command !="snake"):
                format_command = "pascal"  # default
            formatted_class_name = utils.text_to_case(format_command, format_me)
    (Text(modifiers_string + "class " + formatted_class_name + " {") + Key("enter")).execute()
def defineMethod(text, _node):
    commands = _node.words()
    method_index = commands.index("method")
    modifiers_string = getModifiers(commands[:method_index])
    formatted_class_name = ""
    if text:
        format_me = str(text)
        if len(commands) > method_index + 1:
            format_command = commands[method_index + 1]
            if (format_command != "pascal") and (format_command !="snake"):
                format_command = "camel"  # default
            formatted_class_name = utils.text_to_case(format_command, format_me)
    (Text(modifiers_string + formatted_class_name + "() {") + Key("enter, up, end, left:3")).execute()    
Beispiel #5
0
def defineGeneric(text, generic_type):
    formatted_text = ""
    if text:
        format_me = str(text)
        formatted_text = utils.text_to_case("pascal", format_me)
    Text(generic_type + formatted_text + "> ").execute()
def defineGeneric(text, generic_type):
    formatted_text = ""
    if text:
        format_me = str(text)
        formatted_text = utils.text_to_case("pascal", format_me)
    Text(generic_type + formatted_text + "> ").execute()