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);
 }
示例#2
0
 private static string GetSafeParameterName(ParameterResult result, int index)
 {
     if (!string.IsNullOrEmpty(result.DefaultValue))
     {
         return(GetSafeArgumentName(result, index) + " = " + result.DefaultValue);
     }
     return(GetSafeArgumentName(result, index));
 }
示例#3
0
        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());
            }
        }
示例#4
0
        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);
        }
示例#5
0
 public PythonParameter(ISignature signature, ParameterResult param, Span locus)
 {
     _signature = signature;
     _param     = param;
     _locus     = locus;
 }