0

I'd like to create some sort of Visual Studio add on where I could hover over a line like:

public int counter {get; set;}

and upon selecting my menu item (or light bulb), it would insert a line similar to the following above it:

[DataMember Order=1]
public int counter {get; set;}

I found this example: https://msdn.microsoft.com/en-us/library/dn903708.aspx

but I'm not sure it's taking me in the right direction. I was thinking that adding a menu item might make sense (so I could bind it to a keyboard shortcut), but the tricky part would be intelligently setting the "Order" parameter based on an observation of other instances of that attribute nearby.

Any suggestions?

1
  • Sounds like a good way. We don't do general suggestions here, that's way to broad. If you don't see problems, try to implement it and ask any question that may arise from that in a new post. Commented Feb 24, 2016 at 14:24

1 Answer 1

1

Your digging in the right direction. You might also be interested in the LightBulb extensibilty sample on GitHub.

Additionally, I'd recommend looking into the Roslyn code analysis APIs. The VS 2015 Roslyn based compilers might make it a bit easier to ID where you want those lightbulbs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.