/// <summary> /// Moves the caret to the specified location, staying in the current text view /// if possible. /// /// https://pytools.codeplex.com/workitem/1649 /// </summary> private void GotoLocation(LocationInfo location) { Debug.Assert(location != null); Debug.Assert(location.Line > 0); Debug.Assert(location.Column > 0); if (CommonUtils.IsSamePath(location.FilePath, _textView.GetFilePath())) { var viewAdapter = GetViewAdapter(); viewAdapter.SetCaretPos(location.Line - 1, location.Column - 1); viewAdapter.CenterLines(location.Line - 1, 1); } else { location.GotoSource(_serviceProvider); } }
/// <summary> /// Moves the caret to the specified location, staying in the current text view /// if possible. /// /// https://pytools.codeplex.com/workitem/1649 /// </summary> private void GotoLocation(LocationInfo location) { Debug.Assert(location != null); Debug.Assert(location.Line > 0); Debug.Assert(location.Column > 0); if (CommonUtils.IsSamePath(location.FilePath, _textView.GetFilePath())) { var adapterFactory = _serviceProvider.GetComponentModel().GetService<IVsEditorAdaptersFactoryService>(); var viewAdapter = adapterFactory.GetViewAdapter(_textView); viewAdapter.SetCaretPos(location.Line - 1, location.Column - 1); viewAdapter.CenterLines(location.Line - 1, 1); } else { location.GotoSource(); } }
/// <summary> /// Moves the caret to the specified location, staying in the current text view /// if possible. /// /// https://pytools.codeplex.com/workitem/1649 /// </summary> private void GotoLocation(LocationInfo location) { if (CommonUtils.IsSamePath(location.FilePath, _textView.GetFilePath())) { var adapterFactory = VSGeneroPackage.ComponentModel.GetService <IVsEditorAdaptersFactoryService>(); var viewAdapter = adapterFactory.GetViewAdapter(_textView); viewAdapter.SetCaretPos(location.Line - 1, location.Column - 1); viewAdapter.CenterLines(location.Line - 1, 1); } else { location.GotoSource(); } }
/// <summary> /// Moves the caret to the specified location, staying in the current text view /// if possible. /// /// https://pytools.codeplex.com/workitem/1649 /// </summary> private void GotoLocation(LocationInfo location) { if (CommonUtils.IsSamePath(location.FilePath, _textView.GetFilePath())) { var adapterFactory = VSGeneroPackage.ComponentModel.GetService <IVsEditorAdaptersFactoryService>(); var viewAdapter = adapterFactory.GetViewAdapter(_textView); var lineNum = location.Line - 1; if (lineNum <= 0) { lineNum = _textView.TextBuffer.CurrentSnapshot.GetLineNumberFromPosition(location.Index); } var character = location.Column - 1; // start index if (character < 0) { character = 0; } viewAdapter.SetCaretPos(lineNum, character); viewAdapter.CenterLines(lineNum, 1); } else { location.GotoSource(_serviceProvider, _textView.GetLanguageVersion(_programFileProvider)); } }
public override void GotoSource(VSOBJGOTOSRCTYPE SrcType) { _locationInfo.GotoSource(); }
public override void GotoSource(VSOBJGOTOSRCTYPE SrcType) { _locationInfo.GotoSource(_serviceProvider); }