public void SignatureDescriptions(string conceptTypeName, string expectedDescription) { var rhetosProjectContext = serviceProvider.GetRequiredService <RhetosProjectContext>(); var conceptType = rhetosProjectContext.DslSyntax.ConceptTypes.Single(a => a.TypeName == conceptTypeName); var description = ConceptTypeTools.SignatureDescription(conceptType); Assert.AreEqual(expectedDescription, description); }
private RhetosSignature CreateRhetosSignature(ConceptType conceptType) { var prefix = " "; var signature = ConceptTypeTools.SignatureDescription(conceptType); var documentation = $"{prefix}* defined by {conceptType.AssemblyQualifiedName}"; var xmlDocumentation = GetDocumentation(conceptType, prefix); if (!string.IsNullOrEmpty(xmlDocumentation)) { documentation = $"{xmlDocumentation}\n{documentation}"; } return(new RhetosSignature() { ConceptType = conceptType, Parameters = ConceptTypeTools.GetParameters(conceptType), Signature = signature, Documentation = documentation }); }
public Task <SignatureHelp> Handle(SignatureHelpParams request, CancellationToken cancellationToken) { log.LogDebug($"SignatureHelp requested at {request.Position.ToLineChr()}."); var rhetosDocument = rhetosWorkspace.Value.GetRhetosDocument(request.TextDocument.Uri.ToUri()); if (rhetosDocument == null) { return(Task.FromResult <SignatureHelp>(null)); } var signatures = rhetosDocument.GetSignatureHelpAtPosition(request.Position.ToLineChr()); if (signatures.signatures == null) { return(Task.FromResult <SignatureHelp>(null)); } ParameterInformation FromRhetosParameter(ConceptMemberSyntax conceptMember) => new ParameterInformation() { Documentation = "", Label = new ParameterInformationLabel(ConceptTypeTools.ConceptMemberDescription(conceptMember)) }; SignatureInformation FromRhetosSignature(RhetosSignature rhetosSignature) => new SignatureInformation() { Documentation = rhetosSignature.Documentation, Label = rhetosSignature.Signature, Parameters = new Container <ParameterInformation>(rhetosSignature.Parameters.Select(FromRhetosParameter)) }; var signatureHelp = new SignatureHelp() { Signatures = new Container <SignatureInformation>(signatures.signatures.Select(FromRhetosSignature)), ActiveSignature = signatures.activeSignature ?? 100, ActiveParameter = signatures.activeParameter ?? 100 }; return(Task.FromResult(signatureHelp)); }