static int Compare(TextEditorLocation a, TextPosition b) { if (a.Line > b.Line) return 1; if (a.Line == b.Line) return a.Column.CompareTo(b.Column); return -1; }
bool GoTo(IFileTab tab, MethodDef method, uint? ilOffset, object @ref) { if (method == null || ilOffset == null) return false; var uiContext = tab.TryGetTextEditorUIContext(); if (uiContext == null) return false; var cm = uiContext.GetCodeMappings(); var mapping = cm.Find(method, ilOffset.Value); if (mapping == null) return false; var location = mapping.StartPosition; var loc = FindLocation(uiContext.GetCodeReferences(location.Line, location.Column), mapping.EndPosition, @ref); if (loc == null) loc = new TextEditorLocation(location.Line, location.Column); uiContext.ScrollAndMoveCaretTo(loc.Value.Line, loc.Value.Column); return true; }