views:

20

answers:

1

hi i'm making a extension for visual studio and the specific thing that i need is get the selected text of the editor windows for further processing. Someone know what interface or service has this? Previously i need to locate the path of the open solution and for that i ask for a service that implements IVsSolution, so for this other problem I thing that there must be some service that provides me this information.

+1  A: 

inside of the OnlayoutChanged the following code would pop up a message with the code selected:

 if (_view.Selection.IsEmpty)
        {
            return;
        }
        else
        {
             string selectedText = _view.Selection.StreamSelectionSpan.GetText();

            MessageBox.Show(selectedText);
        }

anywhere else just get the viewhost and its the _view of type (IWpfTextView)

Stacker