Beispiel #1
0
        private static SparkTagSignature CreateSignature(ITextBuffer textBuffer, string tagSignature, string tagDocumentation, ITrackingSpan currentApplicableSpan)
        {
            var signature = new SparkTagSignature(textBuffer, tagSignature, tagDocumentation, null);

            textBuffer.Changed += signature.OnTextBufferChanged;

            string[]           parameters = tagSignature.Split(' ');
            IList <IParameter> paramList  = new List <IParameter>();

            int spanSearchStart = 0;

            for (int i = 1; i < parameters.Length; i++)
            {
                string param = parameters[i].Trim();
                if (string.IsNullOrEmpty(param))
                {
                    continue;
                }

                int spanStart = tagSignature.IndexOf(param, spanSearchStart);
                if (spanStart >= 0)
                {
                    var span = new Span(spanStart, param.Length);
                    spanSearchStart = spanStart + param.Length;
                    IParameter parameter = new SparkTagParameter("param doc", span, param, signature);
                    paramList.Add(parameter);
                }
            }

            signature.Parameters       = new ReadOnlyCollection <IParameter>(paramList);
            signature.ApplicableToSpan = currentApplicableSpan;
            signature.InitCurrentParameter();
            return(signature);
        }
        private static SparkTagSignature CreateSignature(ITextBuffer textBuffer, string tagSignature, string tagDocumentation, ITrackingSpan currentApplicableSpan)
        {
            var signature = new SparkTagSignature(textBuffer, tagSignature, tagDocumentation, null);
            textBuffer.Changed += signature.OnTextBufferChanged;

            string[] parameters = tagSignature.Split(' ');
            IList<IParameter> paramList = new List<IParameter>();

            int spanSearchStart = 0;
            for (int i = 1; i < parameters.Length; i++)
            {
                string param = parameters[i].Trim();
                if (string.IsNullOrEmpty(param)) continue;

                int spanStart = tagSignature.IndexOf(param, spanSearchStart);
                if (spanStart >= 0)
                {
                    var span = new Span(spanStart, param.Length);
                    spanSearchStart = spanStart + param.Length;
                    IParameter parameter = new SparkTagParameter("param doc", span, param, signature);
                    paramList.Add(parameter);
                }
            }

            signature.Parameters = new ReadOnlyCollection<IParameter>(paramList);
            signature.ApplicableToSpan = currentApplicableSpan;
            signature.InitCurrentParameter();
            return signature;
        }