Closed yaagma closed 3 years ago
the ext simply runs commands in sequence, it doesnt add any extra side operations to track the changes made.
what u need is something like full undo or undo all similar to https://github.com/shagabutdinov/sublime-full-undo
what u need is something like full undo or undo all similar to https://github.com/shagabutdinov/sublime-full-undo
Not exactly. That plugin seems to undo every change in the file, not just the changes in the last executed macro.
What I'm looking for is something like:
"commentDown": [
"START_UNDO_CONTEXT", // <<<<<<<<<<<<<<<<<<<<<<<<
"editor.action.addCommentLine",
"editor.action.copyLinesDownAction",
"editor.action.removeCommentLine"
"END_UNDO_CONTEXT", // <<<<<<<<<<<<<<<<<<<<<<<<
]
So, if I press Ctrl+Z, the complete macro in undone (but no more). I don't know if that is possible.
Thanks
mmmm, maybe create another custom command like https://github.com/geddski/macros/pull/13 where u put a command u want to run and the one you want to execute accordingly ex.
"macros": {
"undoMacroChanges": [
{"command": "undo", "args": {"command": "commentDown"}},
]
}
so now when u execute undoMacroChanges
the function will run the undo
command times the number of the commentDown
array count
mmmm, maybe create another custom command like #13 where u put a command u want to run and the one you want to execute accordingly ex.
"macros": { "undoMacroChanges": [ {"command": "undo", "args": {"command": "commentDown"}}, ] }
so now when u execute
undoMacroChanges
the function will run theundo
command times the number of thecommentDown
array count
It could be, but I think it would be more usable if you could somehow use Ctrl+z instead of a new command. If I understand this solution, when you press a keybinding to do a command and you want to undo its effect, you must stop and answer yourself ¿Was this a simple command or was it a macro? ¿Should I use Ctr+z or should I use "undoMacroChanges" command?
I'd like that, when I want to undo a keybinding effect, native commands and macros behave the same way (when using Ctrl+Z)
Sorry. English it's not my native language.
Thanks
@ctf0 Your fork works great, however i can't raise issues on your repo
@tberghuis i didn't notice it was off, done
try https://marketplace.visualstudio.com/items?itemName=ctf0.macros
There is no difference. Ctrl+z behaves the same way: only last action is undone (not the whole macro). ¿What should I try?
Thanks
the ctrl+z wont work as u expect because macros are not a native command, what u need is to create another command that counter the effect of the ran macro ex.https://github.com/ctf0/macros#new
Ok. Just to confirm: so for EVERY macro M
I'd want to undo I should create another macro undoM
and assign it a DIFFERENT keybinding, isn't it?
It would be awesome that vs code would allow to interact with the undo manager to insert some form of composite action (composed by all the macro actions) and then it could handle this situation automatically for us.
Thanks for your work.
Ok. Just to confirm: so for EVERY macro
M
I'd want to undo I should create another macroundoM
and assign it a DIFFERENT keybinding, isn't it?
correct
The extension is GREAT. But when using Undo (Ctrl+Z), I'd like to be able to undo all the actions of the macro; not just the last one.
For example, in this macro, only "editor.action.removeCommentLine" is undone.
To Undo a macro, I have to type "Ctrl+Z" as many times as editor actions it has.
Thanks