Пример #1
0
        void OnBufferChanged(object sender, TextChangeArgs args)
        {
            if (!_enabled.Value)
            {
                return;
            }

            if (ShouldCloseCompletionWindow(args.NewText))
            {
                _state = State.Idle;
                CodeCompletionWindow.CloseList();
                return;
            }

            _state = State.UpdateScreenRectNeeded;
            _codeView.Repaint();
        }
Пример #2
0
        public void OnGUI()
        {
            if (_state == State.ShowWindow)
            {
                _state = State.Idle;

                if (_word.Length == 0)
                {
                    CodeCompletionWindow.CloseList();
                    return;
                }

                var input    = new CodeCompletionWindowInput();
                var provider = new CodeCompletionListItemProvider(_word);
                input.m_ItemProvider      = provider;
                input.m_ItemGUI           = new CodeCompletionListItemGUI(18, provider);
                input.m_OnSelectCallback += CodeCompletionCallback;
                input.m_SelectedListIndex = 0;                 // Use -1 for invisible marker when showing
                input.m_CodeView          = _codeView;

                CodeCompletionWindow.ShowAtPosition(_wordScreenRect, input, _textView.Settings);
            }
        }