Exemplo n.º 1
0
        internal void ComputeCurrentParameter()
        {
            if (Parameters.Count == 0)
            {
                CurrentParameter = null;
                return;
            }

            //the number of commas in the string is the index of the current parameter
            var sigText = ApplicableToSpan.GetText(Buffer.CurrentSnapshot);

            var currentIndex = 0;
            var commaCount   = 0;

            while (currentIndex < sigText.Length)
            {
                var commaIndex = sigText.IndexOf(',', currentIndex);
                if (commaIndex == -1)
                {
                    break;
                }
                commaCount++;
                currentIndex = commaIndex + 1;
            }

            if (commaCount < Parameters.Count)
            {
                CurrentParameter = Parameters[commaCount];
            }
            else
            {
                //too many commas, so use the last parameter as the current one.
                CurrentParameter = Parameters[Parameters.Count - 1];
            }
        }
        public void ComputeCurrentParameter()
        {
            if (parameters.Count == 0)
            {
                currentParameter = null;
                return;
            }

            string text = ApplicableToSpan.GetText(this.textBuffer.CurrentSnapshot);

            int currentIndex = 0;
            int commaCount   = 0;

            while (currentIndex < text.Length)
            {
                int commaIndex = text.IndexOf(',', currentIndex);
                if (commaIndex == -1)
                {
                    break;
                }
                commaCount++;
                currentIndex = commaIndex + 1;
            }

            if (commaCount < Parameters.Count)
            {
                this.CurrentParameter = Parameters[commaCount];
            }
            else
            {
                //too many commas, use the last parameter as the current one.
                //
                this.CurrentParameter = Parameters[Parameters.Count - 1];
            }
        }
Exemplo n.º 3
0
        internal void InitCurrentParameter()
        {
            if (Parameters.Count == 0)
            {
                CurrentParameter = null;
                return;
            }

            string signatureText = ApplicableToSpan.GetText(_textBuffer.CurrentSnapshot);

            int currentIndex = 0;
            int spaceCount   = 0;

            while (currentIndex < signatureText.Length)
            {
                int commaIndex = signatureText.IndexOf(' ', currentIndex);
                if (commaIndex == -1)
                {
                    break;
                }
                spaceCount++;
                currentIndex = commaIndex + 1;
            }

            CurrentParameter = spaceCount < Parameters.Count
                                   ? Parameters[spaceCount]
                                   : Parameters[Parameters.Count - 1];
        }
        internal void ComputeCurrentParameter(int atPosition = -1)
        {
            if (Parameters.Count == 0)
            {
                this.CurrentParameter = null;
                return;
            }

            //the number of commas in the string is the index of the current parameter
            string sigText = ApplicableToSpan.GetText(m_subjectBuffer.CurrentSnapshot);

            if (atPosition == -1)
            {
                atPosition = sigText.Length;
            }

            int currentIndex = 0;
            int commaCount   = 0;
            int maxPos       = Math.Min(atPosition, sigText.Length);

            //if (comma)
            //    commaCount += 1;
            while (currentIndex < maxPos)
            {
                int commaIndex = sigText.IndexOf(',', currentIndex);
                if ((commaIndex == -1) || (commaIndex > maxPos))
                {
                    break;
                }
                commaCount++;
                currentIndex = commaIndex + 1;
            }

            if (commaCount < Parameters.Count)
            {
                this.CurrentParameter = Parameters[commaCount];
            }
            else
            {
                //too many commas, so use the last parameter as the current one.
                //this.CurrentParameter = Parameters[Parameters.Count - 1];
            }
        }
Exemplo n.º 5
0
        void CalculateCurrentParameter()
        {
//      Contract.Requires(method != null);
//     Contract.Requires(method != null);

            /* Taken from a walkthrough on MSDN found here:
             * http://msdn.microsoft.com/en-us/library/ee334194(v=VS.100).aspx
             */

            if (Parameters.Count == 0)
            {
                CurrentParameter = null;
                return;
            }

            //the number of commas in the string is the index of the current parameter
            var sigText = ApplicableToSpan.GetText(_textBuffer.CurrentSnapshot);

            int currentIndex = 0;
            int commaCount   = 0;

            while (currentIndex < sigText.Length)
            {
                int commaIndex = sigText.IndexOf(',', currentIndex);
                if (commaIndex == -1)
                {
                    break;
                }
                commaCount++;
                currentIndex = commaIndex + 1;
            }

            if (commaCount < Parameters.Count)
            {
                CurrentParameter = Parameters[commaCount];
            }
            else
            {
                //too many commas, so use the last parameter as the current one.
                CurrentParameter = Parameters[Parameters.Count - 1];
            }
        }
Exemplo n.º 6
0
        internal void ComputeCurrentParameter(int atPosition = -1)
        {
            if (Parameters.Count == 0)
            {
                this.CurrentParameter = null;
                return;
            }

            //the number of commas in the string is the index of the current parameter
            string sigText = ApplicableToSpan.GetText(m_subjectBuffer.CurrentSnapshot);

            if (atPosition == -1)
            {
                atPosition = sigText.Length;
            }
            var commaCount = CalculateCommaPosition(sigText, atPosition, m_subjectBuffer);

            if (commaCount < Parameters.Count)
            {
                this.CurrentParameter = Parameters[commaCount];
            }
        }
Exemplo n.º 7
0
        internal void ComputeCurrentParameter()
        {
            if (Parameters.Count == 0)
            {
                this.CurrentParameter = null;
                return;
            }

            //the number of commas in the string is the index of the current parameter
            string sigText    = ApplicableToSpan.GetText(m_subjectBuffer.CurrentSnapshot);
            int    commaCount = sigText.Count(c => c == ',');

            if (commaCount < Parameters.Count)
            {
                this.CurrentParameter = Parameters[commaCount];
            }
            else
            {
                //too many commas, so use the last parameter as the current one.
                this.CurrentParameter = Parameters[Parameters.Count - 1];
            }
        }
Exemplo n.º 8
0
        internal void ComputeCurrentParameter()
        {
            if (Parameters.Count == 0)
            {
                this.CurrentParameter = null;
                return;
            }

            //the number of commas in the string is the index of the current parameter
            string sigText = ApplicableToSpan.GetText(m_subjectBuffer.CurrentSnapshot);

            Debug.WriteLine("ComputeCurrentParameter {0} Text:{1}", m_content, sigText);

            int currentIndex = 0;
            int commaCount   = 0;

            while (currentIndex < sigText.Length)
            {
                int commaIndex = sigText.IndexOf(',', currentIndex);
                if (commaIndex == -1)
                {
                    break;
                }
                commaCount++;
                currentIndex = commaIndex + 1;
            }

            if (commaCount < Parameters.Count)
            {
                this.CurrentParameter = Parameters[commaCount];
            }
            else
            {
                //too many commas, so use the last parameter as the current one.
                this.CurrentParameter = Parameters[Parameters.Count - 1];
            }
        }