public async Task FunctionInfoTest1(string name) { var functionInfo = await _functionIndex.GetFunctionInfoAsync(name); functionInfo.Should().NotBeNull(); functionInfo.Name.Should().Be(name); functionInfo.Description.Should().NotBeEmpty(); functionInfo.Signatures.Should().ContainSingle() .Which.Arguments.Should().ContainSingle(); var locusPoints = new List <int>(); functionInfo.Signatures[0].GetSignatureString(name, locusPoints).Should().Be(name + "(x)"); locusPoints.Should().Equal(4, 5); }
private IEnumerable <IRFunctionSignatureHelp> GetSignaturesAsync(RFunctionSignatureInfo signatureInfo, IRIntellisenseContext context, Action <IEnumerable <IRFunctionSignatureHelp> > callback) { var snapshot = context.EditorBuffer.CurrentSnapshot; var position = Math.Min(Math.Min(signatureInfo.FunctionCall.SignatureEnd, context.Position), snapshot.Length); var applicableToSpan = GetApplicableSpan(signatureInfo, context); IFunctionInfo functionInfo = null; string packageName = null; // First try user-defined function if (string.IsNullOrEmpty(signatureInfo.PackageName)) { functionInfo = context.AstRoot.GetUserFunctionInfo(signatureInfo.FunctionName, position); } else { packageName = signatureInfo.PackageName; } if (functionInfo != null) { return(MakeSignatures(functionInfo, applicableToSpan, context)); } if (callback != null) { // Get collection of function signatures from documentation (parsed RD file) _functionIndex.GetFunctionInfoAsync(signatureInfo.FunctionName, packageName, (fi, o) => { InvokeSignaturesCallback(fi, applicableToSpan, context, callback); }); } return(null); }
private static async Task GetFunctionInfoFromPackageAsync(IFunctionIndex functionIndex, string functionName, string packageName, Action <IFunctionInfo, object> callback, object parameter) { IFunctionInfo fi = null; packageName = packageName ?? await functionIndex.GetPackageNameAsync(functionName); if (!string.IsNullOrEmpty(packageName)) { fi = await functionIndex.GetFunctionInfoAsync(functionName, packageName); } await functionIndex.Services.MainThread().SwitchToAsync(); callback(fi, parameter); }
private void TryFetchDescription() { Task.Run(async() => { SetDescription(await _functionIndex.GetFunctionInfoAsync(this.DisplayText)); }).Wait(500); }