geddski / macros

macros support for VS Code
MIT License
165 stars 36 forks source link

How to declare multiple commands/macros #46

Open psylion opened 5 years ago

psylion commented 5 years ago

I tried to declare 2 macros command name, but got issues, "command not found"?

ctf0 commented 5 years ago

maybe like this

"macros": {
        "addSemicolonToLineEnd": [
            "cursorEnd",
            {
                "command": "type",
                "args": {
                    "text": ";"
                }
            }
        ],
        "addCommaToLineEnd": [
            "cursorEnd",
            {
                "command": "type",
                "args": {
                    "text": ","
                }
            }
        ],
    },

and u call it like

{
        "key": ";",
        "command": "macros.addSemicolonToLineEnd",
        "when": "editorTextFocus && editorLangId == 'php'"
    },
    {
        "key": ",",
        "command": "macros.addCommaToLineEnd",
        "when": "editorTextFocus && editorLangId == 'json'"
    },