I'm writing a VS extension to scan the currently opened solution / projects for some rules in xaml code.
For now the xaml files are simply processed as an XDocument
. The rule violations are shown in a ListView
from where I can open the related ProjectItem
on click.
How can I extend this to rebuild the behaviour of VS's Find All
where a click opens the related file and automatically jumps to the appropriate line and position in the file?
After you have opened the file, use EnvDTE.TextSelection.MoveToLineAndOffset method:
EnvDTE.TextSelection ts = dte.ActiveDocument.Selection as EnvDTE.TextSelection;
ts.MoveToLineAndOffset(line, column);