exceedsystem / vscode-macros

This extension gives the macro features to your vscode.
https://marketplace.visualstudio.com/items?itemName=EXCEEDSYSTEM.vscode-macros
MIT License
41 stars 2 forks source link

Provide context and activation subscription for macros #18

Open tomaszs opened 3 months ago

tomaszs commented 3 months ago

Hello. Congratulations on the awesome extension. I have a use case where I want to use extension to listen to a context menu event and execute custom command.

Everything is working except one thing. To be able to subscribe to an event I'd need to have access to the context object.

The same you use to register macro commands in the menu.

So far I've figured out it may be possible to create a kind of global variable and put the context there to be accessible from macros.

It would expand the use cases of the extention because we'd be able to write macros that tap into vscode.

Building on the idea it would be even greater to be able to define next to a macro, an activation even listener.

That way I could subscribe to interesting events at the start of the extension. It would only require a check if the context can be stored in a way macro can use it.

Cheers! Have a nice day and again congrats on the amazing extension!

tomaszs commented 3 months ago

Thanks for updating the ticket. I've explained the motivations for this enhancement in an article here: https://tomaszs2.medium.com/vscode-macros-saved-me-1000s-of-seconds-of-misery-f1946696ec94?sk=2704992e68c5bf0bb79aae8151dd3627

exceedsystem commented 3 months ago

@tomaszs

Thank you for your excellent suggestion and the great Medium article.

I would also like to implement the feature you suggested at some point. Unfortunately, I am currently involved in several projects with tight schedules and am unable to find time for OSS development, so I'm not sure when I can start working on your proposal.

If possible, I would appreciate your contribution.

Best regards,

tomaszs commented 3 months ago

@exceedsystem Thanks for the invite to contribute. Hear you. I'm in the same spot 😅 I don't know if and when I could add it. But for the future reference it would involve two things in short.as I imagine it draftly:

What do you think about that approach ?