Exemplo n.º 1
0
        public async Task <SignatureHelp> GetSignatureHelpAsync(IRIntellisenseContext context)
        {
            context.EditorBuffer.GetEditorDocument <IREditorDocument>().EditorTree.EnsureTreeReady();

            var tcs  = new TaskCompletionSource <SignatureHelp>();
            var sigs = _signatureEngine.GetSignaturesAsync(context, e => {
                using (context.AstReadLock()) {
                    tcs.TrySetResult(ToSignatureHelp(e.ToList(), context));
                }
            });

            if (sigs != null)
            {
                using (context.AstReadLock()) {
                    return(ToSignatureHelp(sigs.ToList(), context));
                }
            }
            return(await tcs.Task);
        }
Exemplo n.º 2
0
        public Task <Hover> GetHoverAsync(IRIntellisenseContext context, CancellationToken ct)
        {
            var tcs = new TaskCompletionSource <Hover>();

            using (context.AstReadLock()) {
                var infos = _signatureEngine.GetQuickInfosAsync(context, e => {
                    var r = !ct.IsCancellationRequested ? ToHover(e.ToList(), context.EditorBuffer) : null;
                    tcs.TrySetResult(r);
                });
                return(infos != null?Task.FromResult(ToHover(infos.ToList(), context.EditorBuffer)) : tcs.Task);
            }
        }
Exemplo n.º 3
0
        private static IEnumerable <IRFunctionSignatureHelp> MakeSignatures(IFunctionInfo functionInfo, ITrackingTextRange applicableToSpan, IRIntellisenseContext context)
        {
            var signatures = new List <IRFunctionSignatureHelp>();

            if (functionInfo?.Signatures != null)
            {
                using (context.AstReadLock()) {
                    signatures.AddRange(functionInfo.Signatures.Select(s => RFunctionSignatureHelp.Create(context, functionInfo, s, applicableToSpan)));
                    context.Session.Properties["functionInfo"] = functionInfo;
                }
            }
            return(signatures);
        }