Пример #1
0
        /// <summary>
        /// Primary entry point for intellisense. This is where intellisense list is getting created.
        /// </summary>
        /// <param name="session">Completion session</param>
        /// <param name="completionSets">Completion sets to populate</param>
        public void AugmentCompletionSession(ICompletionSession session, IList <CompletionSet> completionSets)
        {
            _shell.AssertIsOnMainThread();

            IREditorDocument doc = REditorDocument.TryFromTextBuffer(_textBuffer);

            if (doc == null)
            {
                return;
            }

            int position = session.GetTriggerPoint(_textBuffer).GetPosition(_textBuffer.CurrentSnapshot);

            if (!doc.EditorTree.IsReady)
            {
                var textView = session.TextView;
                doc.EditorTree.InvokeWhenReady((o) => {
                    RCompletionController controller = ServiceManager.GetService <RCompletionController>(textView);
                    if (controller != null)
                    {
                        controller.ShowCompletion(autoShownCompletion: true);
                        controller.FilterCompletionSession();
                    }
                }, null, this.GetType(), processNow: true);
            }
            else
            {
                PopulateCompletionList(position, session, completionSets, doc.EditorTree.AstRoot);
            }
        }
Пример #2
0
        public static RCompletionController Create(
            ITextView textView,
            IList <ITextBuffer> subjectBuffers,
            ICompletionBroker completionBroker,
            IQuickInfoBroker quickInfoBroker,
            ISignatureHelpBroker signatureBroker,
            ICoreShell shell)
        {
            RCompletionController completionController;

            completionController = ServiceManager.GetService <RCompletionController>(textView);
            if (completionController == null)
            {
                completionController = new RCompletionController(textView, subjectBuffers, completionBroker, quickInfoBroker, signatureBroker, shell);
            }

            return(completionController);
        }