Esempio n. 1
0
        private void ActiveSession_Committed(object sender, EventArgs e)
        {
            ICompletionSession completionSession = sender as ICompletionSession;

            if (completionSession != null && CompletionSessionExtensions.IsSelected(completionSession.SelectionStatus))
            {
                ICodeAidCompletion codeAidCompletion = completionSession.SelectionStatus.SelectedCompletion as ICodeAidCompletion;
                if (codeAidCompletion != null)
                {
                    int  completionCaretDelta = codeAidCompletion.CompletionCaretDelta;
                    bool flag = completionCaretDelta > 0;
                    int  num  = Math.Abs(completionCaretDelta);
                    for (int index = 0; index < num; ++index)
                    {
                        if (flag)
                        {
                            this.editorOperations.MoveToNextCharacter(false);
                        }
                        else
                        {
                            this.editorOperations.MoveToPreviousCharacter(false);
                        }
                    }
                }
            }
            this.OnActiveSessionClosed();
        }
Esempio n. 2
0
 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();
 }
Esempio n. 3
0
        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
            });
        }