public PythonParameter(ISignature signature, ParameterResult param, Span locus, Span ppLocus) { _signature = signature; _param = param; _locus = locus; _ppLocus = ppLocus; _documentation = _param.Documentation.LimitLines(15, stopAtFirstBlankLine: true); }
private static string GetSafeParameterName(ParameterResult result, int index) { if (!string.IsNullOrEmpty(result.DefaultValue)) { return(GetSafeArgumentName(result, index) + " = " + result.DefaultValue); } return(GetSafeArgumentName(result, index)); }
private static string GetSafeArgumentName(ParameterResult result, int index) { var match = ValidParameterName.Match(result.Name); if (match.Success) { return(match.Value); } else if (result.Name.StartsWith("**")) { return("**kwargs"); } else if (result.Name.StartsWith("*")) { return("*args"); } else { return("arg" + index.ToString()); } }
private static ISignature[] GetLiveSignatures(string text, ICollection <OverloadDoc> liveSigs, int paramIndex, ITrackingSpan span) { ISignature[] res = new ISignature[liveSigs.Count]; int i = 0; foreach (var sig in liveSigs) { var parameters = new ParameterResult[sig.Parameters.Length]; int j = 0; foreach (var param in sig.Parameters) { parameters[j++] = new ParameterResult(param.Name); } res[i++] = new PythonSignature( span, new LiveOverloadResult(text, sig.Documentation, parameters), paramIndex ); } return(res); }
public PythonParameter(ISignature signature, ParameterResult param, Span locus) { _signature = signature; _param = param; _locus = locus; }