I am in the focus of a ToolWindow. By doing dobleclick on a TreeView node, the cursor has to move to a particular line within the opened source code document. I solved this issue by calling the Edit.GoTo Line command like this:
var commandName = "Edit.GoTo " + lineNumber;
_dte.ExecuteCommand(commandName);
However I am not quite convinient with that as I lose the focus of the toolwindow. Is there another way to move to a line by using the Automation API?
Use the
IViewScroller.EnsureSpanVisible(SnapshotSpan span, EnsureSpanVisibleOptions options)To create a span, use:
And to scroll to the span:
Where
viewis theIWpfTextViewprovided by your adorner (IWpfTextViewCreationListener)