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); }
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); } }
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); }