macros icon indicating copy to clipboard operation
macros copied to clipboard

Feature Request: Control Structures

Open lrd1967 opened this issue 7 years ago • 1 comments

Is it possible to implement simple control structures to repeat a macro or a block inside a macro (or even a macro calling another macro) n-times or until end-of-line or end-of-file, for example?

lrd1967 avatar Jan 24 '18 14:01 lrd1967

Or allow full access to JavaScript. I currently have these macros:

    "macros": {
        "keyboardScrollDown": [
            "cursorDown",
            {
                "command": "editorScroll",
                "args": {
                    "to": "down",
                    "by": "line",
                    "revealCursor": true
                }
            }
        ],
        "keyboardScrollUp": [
            "cursorUp",
            {
                "command": "editorScroll",
                "args": {
                    "to": "up",
                    "by": "line",
                    "revealCursor": true
                }
            }
        ]
    }

with keybindings:

    {
        "key": "ctrl+down",
        "command": "macros.keyboardScrollDown"
    },
    {
        "key": "ctrl+up",
        "command": "macros.keyboardScrollUp"
    }

I'd like to be able to run the "cursorUp" and "cursorDown" conditionally, only if the cursor moves outside the window (to keep it inside the window while ctrl-scrolling). That would allow me to emulate Visual Studio and Sublime behaviour.

If we had access to JavaScript that would solve your request and mine as well, provided we can query all editor properties.

dlidstrom avatar Jul 10 '19 06:07 dlidstrom