Closed carbtest closed 1 month ago
While you can't nest commands (I'm not sure what you'd want that to do) you definitely can do the task you described.
Here's a macro of mine that might do what you want:
{
"SendLineToTerminal": [
{
"javascript": [
"sharedMacroInfo.prevSelectedText = window.activeTextEditor.document.getText(window.activeTextEditor.selections[0])",
],
},
// format some python
{
"injections": [
{
"replace": "$currentLines",
"withResultOf": "sharedMacroInfo.prevSelectedText"
},
],
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "$currentLines\n\n"
}
},
"cursorDown",
],
}
I'm not sure why you'd need to join the lines, I'm pretty sure the get-selection returns a string not an array. So you should be able to get
I've also updated "terminalExample2" in the readme.md to better show how javascript and normal commands can be combined.
Send another comment here if it still doesn't make sense
For example i want to create a macro that will grab selected lines from editor join them using vscode macro-commander extension vs 1.5.1 by Jeff Hykin how how would I write a macro to
here is a sample of what i have tried