Im writing a visual studio (2010) extension with a right click menu whilst in a code view. I want to be able to examine the current code from my menu item event handler but have
You may be looking for
Document doc = DTE.ActiveDocument; TextDocument txt = doc.Object() as TextDocument;
You should then be able to edit work with the TextDocument as needed.