Exemplo n.º 1
0
        public bool ExecuteCommand(NavigateToPreviousIssueInDocumentCommandArgs args, CommandExecutionContext executionContext)
        {
            var snapshot = args.TextView.TextSnapshot;
            var spans    = this.GetTagSpansCollection(snapshot, args.ErrorTagTypeNames);

            if (spans.Count == 0)
            {
                return(true);
            }

            (int indexOfErrorSpan, bool containsPoint) = IndexOfTagSpanNearPoint(spans, args.TextView.Caret.Position.BufferPosition.Position);

            int nextIndex = indexOfErrorSpan - 1;

            if (containsPoint && (spans.Count == 1))
            {
                // There is only one error tag and it contains the caret. Ensure it stays put.
                return(true);
            }

            // Wrap if needed.
            if (nextIndex < 0)
            {
                nextIndex = (spans.Count - 1);
            }

            args.TextView.Caret.MoveTo(new SnapshotPoint(snapshot, spans[nextIndex].Start));
            args.TextView.Caret.EnsureVisible();
            return(true);
        }
Exemplo n.º 2
0
 public CommandState GetCommandState(NavigateToPreviousIssueInDocumentCommandArgs args) => CommandState.Available;
 public bool ExecuteCommand(NavigateToPreviousIssueInDocumentCommandArgs args, CommandExecutionContext executionContext)
 {
     return(NavigateToPreviousIssue(args, executionContext));
 }