예제 #1
0
        internal bool AugmentQuickInfoSession(AstRoot ast, ITextBuffer textBuffer, int position, IQuickInfoSession session,
                                              IList <object> quickInfoContent, out ITrackingSpan applicableToSpan,
                                              Action <IEnumerable <IRFunctionQuickInfo>, IQuickInfoSession> callback)
        {
            // Try cached if this was a re-trigger on async information retrieval
            var eis = new EditorIntellisenseSession(session, _services);

            if (GetCachedSignatures(quickInfoContent, textBuffer, position, _infos, out applicableToSpan))
            {
                return(true);
            }

            var context = new RIntellisenseContext(eis, textBuffer.ToEditorBuffer(), ast, position);
            // See if information is immediately available
            var infos = _engine.GetQuickInfosAsync(context, null);

            if (infos != null)
            {
                AddQuickInfos(quickInfoContent, MakeQuickInfos(infos));
                return(true);
            }

            // If not available, start async retrieval. Session wil be re-triggered
            // when information becomes available.
            _engine.GetQuickInfosAsync(context, x => callback(x, session));
            return(false);
        }
예제 #2
0
        private IRIntellisenseContext CreateContext(Position position)
        {
            var bufferPosition = EditorBuffer.ToStreamPosition(position);
            var session        = new EditorIntellisenseSession(new EditorView(EditorBuffer, position.ToStreamPosition(EditorBuffer.CurrentSnapshot)), _services);

            return(new RIntellisenseContext(session, EditorBuffer, Document.EditorTree, bufferPosition));
        }
예제 #3
0
        public bool AugmentSignatureHelpSession(ISignatureHelpSession session, IList <ISignature> signatures, AstRoot ast,
                                                Action <ITextView, IEnumerable <IRFunctionSignatureHelp> > callback)
        {
            // Try cached if this was a re-trigger on async information retrieval
            var eis = new EditorIntellisenseSession(session, _services);

            if (GetCachedSignatures(signatures, eis))
            {
                return(true);
            }

            var editorBuffer = _textBuffer.ToEditorBuffer();
            var position     = session.GetTriggerPoint(_textBuffer).GetCurrentPosition();
            var context      = new RIntellisenseContext(eis, editorBuffer, ast, position);

            // See if information is immediately available
            var sigs = _engine.GetSignaturesAsync(context, null);

            if (sigs != null)
            {
                AddSignatures(signatures, ToVsEditorSignatures(sigs));
                return(true);
            }

            // If not available, start async retrieval. Session wil be re-triggered
            // when information becomes available.
            _engine.GetSignaturesAsync(context, s => callback(session.TextView, s));
            return(false);
        }