Custom Macro that generates code somewhere else in the class


I am building a custom macro to be used with a specific live template (reason: increase productivity in a specific project).
What I want the macro to do is: after it has finished (so on the Finish event of the

SnippetIn the handler for the FinisghedHotspotSession) write some code in the constructor and include a namespace if it is missing.
In the handler for the Finish event I get a reference to the HotSpotSession.

I do not understand how am I suppose to generate the code. I suppose I need somehow to get a reference to the Class I added the tempalte in and start from there.

My question are:
1. Is my approach corect ? Can I really use macros for my situation ?
2. How do I generate code starting from a HotSpotSession ?
Comment actions Permalink

Funny, nobody knoes anything.

Comment actions Permalink

You can always extend Resharper with an addin to create a more powerfull macro wich fit your needs.
Thats all what I can say.

Comment actions Permalink

That's not very usefull.

Unless you know how I can interfeer in the way macros are handled by Resharper.

Comment actions Permalink

I'm sorry. I don't think I can help you. The idea with the macro is something I would have tried when the built in macros do not fit my needs.
But the hole Resharper-Addin "Thing" is a great mysterious. To learn something the best aproach seems to study examples and other addins. Wich is really slow I think.

What I found out was that Macros implement IMacro. But as a quick look there seems to be no "Finnished" event to hook in.

Well if you could provide some detailed example mybee we can find some way. I hope some Resharper guy is seeing this thread and can give you some hint. There is also a forum related to addins/extending resharper if you have to take this way.


Please sign in to leave a comment.