I'm struggling to work out how you're supposed to edit selected text in a text file when a command in my VSPackage extension is clicked. I've seen this question asked before, but the documents linked to didn't help me. I'm asking this question again, as it looked as though that question had been answered, so thought I might have to add it again to get an answer.
I can get a IVsTextManager and IVsTextView, and even the selected text, but can't work out how to get an ITextBuffer etc to do any editing. Some places seem to indicate that I need to make a MEF component to do the editing, but I can't find any documentation about how to do that... although that could just be me struggling to find the right stuff. If that is how you're supposed to do it, how do I call that from my command?
I'm using VS 2013, but could move to VS2015 if it's easier with that.