コード例 #1
0
        /// <summary>
        /// Send the command to the current session head
        /// </summary>
        internal bool SendCommand(IntellisenseKeyboardCommand command)
        {
            // Don't send the command if the active completion set is not the word completion
            // set
            if (_wordCompletionSet != _completionSession.SelectedCompletionSet)
            {
                return(false);
            }

            var commandTarget = _intellisenseSessionStack as IIntellisenseCommandTarget;

            if (commandTarget == null)
            {
                return(false);
            }

            // Send the command
            if (!commandTarget.ExecuteKeyboardCommand(command))
            {
                return(false);
            }

            // Command succeeded so there is a new selection.  Put the new selection into the
            // ITextView to replace the current selection
            var wordSpan = TrackingSpanUtil.GetSpan(_textView.TextSnapshot, _wordTrackingSpan);

            if (wordSpan.IsSome() &&
                _wordCompletionSet.SelectionStatus != null &&
                _wordCompletionSet.SelectionStatus.Completion != null)
            {
                _textView.TextBuffer.Replace(wordSpan.Value, _wordCompletionSet.SelectionStatus.Completion.InsertionText);
            }

            return(true);
        }
コード例 #2
0
        public bool ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
        {
            switch (command)
            {
            case IntellisenseKeyboardCommand.Up:
                MoveCurrentByIdx(-1);
                return(true);

            case IntellisenseKeyboardCommand.PageUp:
                MoveCurrentByIdx(-10);
                return(true);

            case IntellisenseKeyboardCommand.Down:
                MoveCurrentByIdx(1);
                return(true);

            case IntellisenseKeyboardCommand.PageDown:
                MoveCurrentByIdx(10);
                return(true);

            case IntellisenseKeyboardCommand.Escape:
                this.CompletionSession.Dismiss();
                return(true);

            default:
                return(false);
            }
        }
コード例 #3
0
ファイル: WordCompletionSession.cs プロジェクト: Kazark/VsVim
        /// <summary>
        /// Send the command to the current session head
        /// </summary>
        internal bool SendCommand(IntellisenseKeyboardCommand command)
        {
            // Don't send the command if the active completion set is not the word completion
            // set
            if (_wordCompletionSet != _completionSession.SelectedCompletionSet)
            {
                return false;
            }

            var commandTarget = _intellisenseSessionStack as IIntellisenseCommandTarget;
            if (commandTarget == null)
            {
                return false;
            }

            // Send the command
            if (!commandTarget.ExecuteKeyboardCommand(command))
            {
                return false;
            }

            // Command succeeded so there is a new selection.  Put the new selection into the
            // ITextView to replace the current selection
            var wordSpan = TrackingSpanUtil.GetSpan(_textView.TextSnapshot, _wordTrackingSpan);
            if (wordSpan.IsSome() &&
                _wordCompletionSet.SelectionStatus != null &&
                _wordCompletionSet.SelectionStatus.Completion != null)
            {
                _textView.TextBuffer.Replace(wordSpan.Value, _wordCompletionSet.SelectionStatus.Completion.InsertionText);
            }

            return true;
        }
コード例 #4
0
 public bool ExecuteKeyboardCommand(IntellisenseKeyboardCommand command) {
     IIntellisenseCommandTarget target = Content as IIntellisenseCommandTarget;
     if (target != null) {
         return target.ExecuteKeyboardCommand(command);
     }
     return false;
 }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public bool ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
        {
            switch (command)
            {
            case IntellisenseKeyboardCommand.Up:
                SelectCompletion(-1);
                return(true);

            case IntellisenseKeyboardCommand.PageUp:
                SelectCompletion(-10);
                return(true);

            case IntellisenseKeyboardCommand.Down:
                SelectCompletion(1);
                return(true);

            case IntellisenseKeyboardCommand.PageDown:
                SelectCompletion(10);
                return(true);

            case IntellisenseKeyboardCommand.Escape:
                this.Session.Dismiss();
                return(true);
            }

            return(false);
        }
コード例 #6
0
        private bool ExecuteKeyboardCommandIfSessionActive(IntellisenseKeyboardCommand command)
        {
            var stackForTextView = _intellisenseSessionStackMapService.GetStackForTextView(_textView);

            if (stackForTextView != null)
            {
                var containsSigHelp = false;
                foreach (var session in stackForTextView.Sessions)
                {
                    if (!containsSigHelp && (session is ISignatureHelpSession))
                    {
                        containsSigHelp = true;
                    }
                    else if (session is ICompletionSession)
                    {
                        if (containsSigHelp)
                        {
                            stackForTextView.MoveSessionToTop(session);
                        }
                        break;
                    }
                }
            }

            var target = stackForTextView as IIntellisenseCommandTarget;

            return(target != null && target.ExecuteKeyboardCommand(command));
        }
コード例 #7
0
		bool IIntellisenseCommandTarget.ExecuteKeyboardCommand(IntellisenseKeyboardCommand command) {
			switch (command) {
			case IntellisenseKeyboardCommand.Escape:
				session.Dismiss();
				return true;

			case IntellisenseKeyboardCommand.Up:
				if (session.Signatures.Count > 1) {
					IncrementSelectedSignature(-1);
					return true;
				}
				return false;

			case IntellisenseKeyboardCommand.Down:
				if (session.Signatures.Count > 1) {
					IncrementSelectedSignature(1);
					return true;
				}
				return false;

			case IntellisenseKeyboardCommand.PageUp:
			case IntellisenseKeyboardCommand.PageDown:
			case IntellisenseKeyboardCommand.Home:
			case IntellisenseKeyboardCommand.End:
			case IntellisenseKeyboardCommand.TopLine:
			case IntellisenseKeyboardCommand.BottomLine:
			case IntellisenseKeyboardCommand.Enter:
			case IntellisenseKeyboardCommand.IncreaseFilterLevel:
			case IntellisenseKeyboardCommand.DecreaseFilterLevel:
			default:
				return false;
			}
		}
コード例 #8
0
        private bool ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
        {
            var target = _editorSessionOpt != null
                ? _editorSessionOpt.Presenter as IIntellisenseCommandTarget
                : null;

            return(target != null && target.ExecuteKeyboardCommand(command));
        }
コード例 #9
0
ファイル: CompletionControl.xaml.cs プロジェクト: xNUTs/PTVS
        public bool ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
        {
            IIntellisenseCommandTarget target = Content as IIntellisenseCommandTarget;

            if (target != null)
            {
                return(target.ExecuteKeyboardCommand(command));
            }
            return(false);
        }
コード例 #10
0
 bool ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
 {
     foreach (var session in sessions)
     {
         if (session.Presenter?.ExecuteKeyboardCommand(command) == true)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #11
0
 public bool ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
 {
     switch (command)
     {
     case IntellisenseKeyboardCommand.Escape:
         if (this.session != null)
         {
             this.session.Dismiss();
             return(true);
         }
         break;
     }
     return(false);
 }
コード例 #12
0
        bool IIntellisenseCommandTarget.ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
        {
            switch (command)
            {
            case IntellisenseKeyboardCommand.Up:
                MoveUpDown(true);
                return(true);

            case IntellisenseKeyboardCommand.Down:
                MoveUpDown(false);
                return(true);

            case IntellisenseKeyboardCommand.PageUp:
                PageUpDown(true);
                return(true);

            case IntellisenseKeyboardCommand.PageDown:
                PageUpDown(false);
                return(true);

            case IntellisenseKeyboardCommand.Escape:
                session.Dismiss();
                return(true);

            case IntellisenseKeyboardCommand.Enter:
                if (session.SelectedCompletionSet?.SelectionStatus.IsSelected == true)
                {
                    session.Commit();
                    return(true);
                }
                return(false);

            case IntellisenseKeyboardCommand.TopLine:
                WpfUtils.ScrollToTop(control.completionsListBox);
                return(true);

            case IntellisenseKeyboardCommand.BottomLine:
                WpfUtils.ScrollToBottom(control.completionsListBox);
                return(true);

            case IntellisenseKeyboardCommand.Home:
            case IntellisenseKeyboardCommand.End:
            case IntellisenseKeyboardCommand.IncreaseFilterLevel:
            case IntellisenseKeyboardCommand.DecreaseFilterLevel:
            default:
                return(false);
            }
        }
コード例 #13
0
        public bool ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
        {
            // Certain keys are important to us.  We'll want to trap things like up/down/escape and make them mean something
            // special to us.

            switch (command)
            {
            case IntellisenseKeyboardCommand.Up:
                return(this.PreviousSignature());

            case IntellisenseKeyboardCommand.Down:
                return(this.NextSignature());

            default:
                break;
            }

            return(false);
        }
コード例 #14
0
        /// <summary>
        /// Calls each of the stack's session presenters, in order, to see if they want to handle the keyboard command
        /// </summary>
        public bool ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
        {
            // We don't care if there's a keyboard session here or not.  If someone has captured the keyboard, this should only get
            // called if the capturer has decided not to handle the command.

            // Run through the sessions from the topmost to the bottom-most.
            foreach (IIntellisenseSession session in _sessions)
            {
                IIntellisenseCommandTarget commandTarget = session.Presenter as IIntellisenseCommandTarget;
                if (commandTarget != null)
                {
                    if (commandTarget.ExecuteKeyboardCommand(command))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
コード例 #15
0
		bool IIntellisenseCommandTarget.ExecuteKeyboardCommand(IntellisenseKeyboardCommand command) {
			switch (command) {
			case IntellisenseKeyboardCommand.Escape:
				session.Dismiss();
				return true;

			case IntellisenseKeyboardCommand.Up:
			case IntellisenseKeyboardCommand.Down:
			case IntellisenseKeyboardCommand.PageUp:
			case IntellisenseKeyboardCommand.PageDown:
			case IntellisenseKeyboardCommand.Home:
			case IntellisenseKeyboardCommand.End:
			case IntellisenseKeyboardCommand.TopLine:
			case IntellisenseKeyboardCommand.BottomLine:
			case IntellisenseKeyboardCommand.Enter:
			case IntellisenseKeyboardCommand.IncreaseFilterLevel:
			case IntellisenseKeyboardCommand.DecreaseFilterLevel:
			default:
				return false;
			}
		}
コード例 #16
0
        public bool ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
        {
            switch (command)
            {
            case IntellisenseKeyboardCommand.Up:
                Move(-1);
                return(true);

            case IntellisenseKeyboardCommand.Down:
                Move(1);
                return(true);

            case IntellisenseKeyboardCommand.PageUp:
                Move(-10);
                return(true);

            case IntellisenseKeyboardCommand.PageDown:
                Move(10);
                return(true);

            case IntellisenseKeyboardCommand.Enter:
                _completionSession.Commit();
                return(true);

            case IntellisenseKeyboardCommand.Escape:
                _completionSession.Dismiss();
                return(true);

            //Maybe one day we'll do something with these below
            case IntellisenseKeyboardCommand.End:
            case IntellisenseKeyboardCommand.Home:
            case IntellisenseKeyboardCommand.DecreaseFilterLevel:
            case IntellisenseKeyboardCommand.IncreaseFilterLevel:
            case IntellisenseKeyboardCommand.TopLine:
            case IntellisenseKeyboardCommand.BottomLine:
                break;
            }
            return(false);
        }
コード例 #17
0
        bool IIntellisenseCommandTarget.ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
        {
            switch (command)
            {
            case IntellisenseKeyboardCommand.Escape:
                session.Dismiss();
                return(true);

            case IntellisenseKeyboardCommand.Up:
            case IntellisenseKeyboardCommand.Down:
            case IntellisenseKeyboardCommand.PageUp:
            case IntellisenseKeyboardCommand.PageDown:
            case IntellisenseKeyboardCommand.Home:
            case IntellisenseKeyboardCommand.End:
            case IntellisenseKeyboardCommand.TopLine:
            case IntellisenseKeyboardCommand.BottomLine:
            case IntellisenseKeyboardCommand.Enter:
            case IntellisenseKeyboardCommand.IncreaseFilterLevel:
            case IntellisenseKeyboardCommand.DecreaseFilterLevel:
            default:
                return(false);
            }
        }
コード例 #18
0
ファイル: HlslKeyProcessor.cs プロジェクト: Samana/HlslTools
        private bool ExecuteKeyboardCommandIfSessionActive(IntellisenseKeyboardCommand command)
        {
            var stackForTextView = _intellisenseSessionStackMapService.GetStackForTextView(_textView);
            if (stackForTextView != null)
            {
                var containsSigHelp = false;
                foreach (var session in stackForTextView.Sessions)
                {
                    if (!containsSigHelp && (session is ISignatureHelpSession))
                    {
                        containsSigHelp = true;
                    }
                    else if (session is ICompletionSession)
                    {
                        if (containsSigHelp)
                            stackForTextView.MoveSessionToTop(session);
                        break;
                    }
                }
            }

            var target = stackForTextView as IIntellisenseCommandTarget;
            return target != null && target.ExecuteKeyboardCommand(command);
        }
コード例 #19
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public bool ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
        {
            switch (command)
            {
                case IntellisenseKeyboardCommand.Up:
                    SelectCompletion(-1);
                    return true;
                case IntellisenseKeyboardCommand.PageUp:
                    SelectCompletion(-10);
                    return true;
                case IntellisenseKeyboardCommand.Down:
                    SelectCompletion(1);
                    return true;
                case IntellisenseKeyboardCommand.PageDown:
                    SelectCompletion(10);
                    return true;
                case IntellisenseKeyboardCommand.Escape:
                    this.Session.Dismiss();
                    return true;
            }

            return false;
        }
            private bool ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
            {
                var target = _editorSessionOpt != null
                    ? _editorSessionOpt.Presenter as IIntellisenseCommandTarget
                    : null;

                return target != null && target.ExecuteKeyboardCommand(command);
            }
コード例 #21
0
ファイル: SparkSensePresenter.cs プロジェクト: aloker/spark
 public bool ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
 {
     switch (command)
     {
         case IntellisenseKeyboardCommand.Up:
             Move(-1);
             return true;
         case IntellisenseKeyboardCommand.Down:
             Move(1);
             return true;
         case IntellisenseKeyboardCommand.PageUp:
             Move(-10);
             return true;
         case IntellisenseKeyboardCommand.PageDown:
             Move(10);
             return true;
         case IntellisenseKeyboardCommand.Enter:
             _completionSession.Commit();
             return true;
         case IntellisenseKeyboardCommand.Escape:
             _completionSession.Dismiss();
             return true;
         //Maybe one day we'll do something with these below
         case IntellisenseKeyboardCommand.End:
         case IntellisenseKeyboardCommand.Home:
         case IntellisenseKeyboardCommand.DecreaseFilterLevel:
         case IntellisenseKeyboardCommand.IncreaseFilterLevel:
         case IntellisenseKeyboardCommand.TopLine:
         case IntellisenseKeyboardCommand.BottomLine:
             break;
     }
     return false;
 }
コード例 #22
0
 bool IIntellisenseCommandTarget.ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
 {
     return _intellisenseCommandTarget != null
         ? _intellisenseCommandTarget.ExecuteKeyboardCommand(command)
         : false;
 }
コード例 #23
0
		bool ExecuteKeyboardCommand(IntellisenseKeyboardCommand command) {
			foreach (var session in sessions) {
				if ((session.Presenter as IIntellisenseCommandTarget)?.ExecuteKeyboardCommand(command) == true)
					return true;
			}
			return false;
		}
コード例 #24
0
 bool IIntellisenseCommandTarget.ExecuteKeyboardCommand(IntellisenseKeyboardCommand command)
 {
     return(_intellisenseCommandTarget != null
         ? _intellisenseCommandTarget.ExecuteKeyboardCommand(command)
         : false);
 }
コード例 #25
0
 public bool ExecuteKeyboardCommand(IntellisenseKeyboardCommand command) {
   switch ( command ) {
     case IntellisenseKeyboardCommand.Escape:
       if ( this.session != null ) {
         this.session.Dismiss();
         return true;
       }
       break;
   }
   return false;
 }
コード例 #26
0
		bool IIntellisenseCommandTarget.ExecuteKeyboardCommand(IntellisenseKeyboardCommand command) {
			switch (command) {
			case IntellisenseKeyboardCommand.Up:
				MoveUpDown(true);
				return true;

			case IntellisenseKeyboardCommand.Down:
				MoveUpDown(false);
				return true;

			case IntellisenseKeyboardCommand.PageUp:
				PageUpDown(true);
				return true;

			case IntellisenseKeyboardCommand.PageDown:
				PageUpDown(false);
				return true;

			case IntellisenseKeyboardCommand.Escape:
				session.Dismiss();
				return true;

			case IntellisenseKeyboardCommand.Enter:
				if (session.SelectedCompletionSet?.SelectionStatus.IsSelected == true) {
					session.Commit();
					return true;
				}
				return false;

			case IntellisenseKeyboardCommand.TopLine:
				WpfUtils.ScrollToTop(control.completionsListBox);
				return true;

			case IntellisenseKeyboardCommand.BottomLine:
				WpfUtils.ScrollToBottom(control.completionsListBox);
				return true;

			case IntellisenseKeyboardCommand.Home:
			case IntellisenseKeyboardCommand.End:
			case IntellisenseKeyboardCommand.IncreaseFilterLevel:
			case IntellisenseKeyboardCommand.DecreaseFilterLevel:
			default:
				return false;
			}
		}