private void OffsetCompletionSelection(int offset)
        {
            if (this.activeSession == null)
            {
                return;
            }
            int count = this.activeSession.Completions.Count;

            if (count == 1)
            {
                this.activeSession.SetSelectionStatus(this.activeSession.Completions[0], CompletionSelectionOptions.Selected | CompletionSelectionOptions.Unique);
            }
            else
            {
                int num   = this.activeSession.Completions.IndexOf(this.activeSession.SelectionStatus.SelectedCompletion);
                int index = num + offset;
                if (index < 0)
                {
                    index = 0;
                }
                else if (index >= count)
                {
                    index = count - 1;
                }
                if (index == num && !CompletionSessionExtensions.IsHollowSelected(this.activeSession.SelectionStatus))
                {
                    return;
                }
                if (CompletionSessionExtensions.IsHollowSelected(this.activeSession.SelectionStatus))
                {
                    index = num;
                }
                this.activeSession.SetSelectionStatus(this.activeSession.Completions[index], CompletionSelectionOptions.Selected | CompletionSelectionOptions.Unique);
            }
        }
        private CodeAidContext CreateCodeAidContext()
        {
            ITextSnapshot             currentSnapshot = this.textView.TextBuffer.CurrentSnapshot;
            CompletionSelectionStatus status          = this.activeSession != null ? this.activeSession.SelectionStatus : (CompletionSelectionStatus)null;
            ICompletion completion1 = status == null || !CompletionSessionExtensions.IsSelected(status) ? (ICompletion)null : this.activeSession.SelectionStatus.SelectedCompletion;
            ICompletion completion2 = status == null || !CompletionSessionExtensions.IsHollowSelected(status) ? (ICompletion)null : this.activeSession.SelectionStatus.SelectedCompletion;
            int         position    = this.LeftmostTextViewSelection();

            return(new CodeAidContext()
            {
                CurrentPosition = new SnapshotPoint(currentSnapshot, position),
                SelectionSpan = this.textView.Selection.SelectionSpan,
                SessionStartingPosition = this.activeSessionStartPoint,
                SessionSelectedCompletion = completion1,
                SessionHollowSelectedCompletion = completion2
            });
        }
 private void CommitCompletionSession(bool shouldCommitHollowSelections)
 {
     if (this.activeSession == null || !CompletionSessionExtensions.IsSelected(this.activeSession.SelectionStatus) && (!shouldCommitHollowSelections || !CompletionSessionExtensions.IsHollowSelected(this.activeSession.SelectionStatus)))
     {
         return;
     }
     this.activeSession.Commit();
     this.textView.Selection.Clear();
     this.textView.Caret.EnsureVisible();
 }