示例#1
0
        internal static void AugmentQuickInfoWorker(ExpressionAnalysis vars, System.Collections.Generic.IList<object> quickInfoContent, out ITrackingSpan applicableToSpan) {
            applicableToSpan = vars.Span;
            if (applicableToSpan == null || String.IsNullOrWhiteSpace(vars.Expression)) {
                return;
            }

            bool first = true;
            var result = new StringBuilder();
            int count = 0;
            List<AnalysisValue> listVars = new List<AnalysisValue>(vars.Values);
            HashSet<string> descriptions = new HashSet<string>();
            bool multiline = false;
            foreach (var v in listVars) {
                string description = null;
                if (listVars.Count == 1) {
                    if (!String.IsNullOrWhiteSpace(v.Description)) {
                        description = v.Description;
                    }
                } else {
                    if (!String.IsNullOrWhiteSpace(v.ShortDescription)) {
                        description = v.ShortDescription;
                    }
                }

                description = description.LimitLines();

                if (description != null && descriptions.Add(description)) {
                    if (first) {
                        first = false;
                    } else {
                        if (result.Length == 0 || result[result.Length - 1] != '\n') {
                            result.Append(", ");
                        } else {
                            multiline = true;
                        }
                    }
                    result.Append(description);
                    count++;
                }
            }

            string expr = vars.Expression;
            if (expr.Length > 4096) {
                expr = expr.Substring(0, 4093) + "...";
            }
            if (multiline) {
                result.Insert(0, expr + ": " + Environment.NewLine);
            } else if (result.Length > 0) {
                result.Insert(0, expr + ": ");
            } else {
                result.Append(expr);
                result.Append(": ");
                result.Append("<unknown type>");
            }

            quickInfoContent.Add(result.ToString());
        }
示例#2
0
        internal static void AugmentQuickInfoWorker(ExpressionAnalysis vars, System.Collections.Generic.IList <object> quickInfoContent, out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = vars.Span;
            if (applicableToSpan == null || String.IsNullOrWhiteSpace(vars.Expression))
            {
                return;
            }

            bool first  = true;
            var  result = new StringBuilder();
            int  count  = 0;
            List <AnalysisValue> listVars     = new List <AnalysisValue>(vars.Values);
            HashSet <string>     descriptions = new HashSet <string>();
            bool multiline = false;

            foreach (var v in listVars)
            {
                string description = null;
                if (listVars.Count == 1)
                {
                    if (!String.IsNullOrWhiteSpace(v.Description))
                    {
                        description = v.Description;
                    }
                }
                else
                {
                    if (!String.IsNullOrWhiteSpace(v.ShortDescription))
                    {
                        description = v.ShortDescription;
                    }
                }

                description = description.LimitLines();

                if (description != null && descriptions.Add(description))
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        if (result.Length == 0 || result[result.Length - 1] != '\n')
                        {
                            result.Append(", ");
                        }
                        else
                        {
                            multiline = true;
                        }
                    }
                    result.Append(description);
                    count++;
                }
            }

            string expr = vars.Expression;

            if (expr.Length > 4096)
            {
                expr = expr.Substring(0, 4093) + "...";
            }
            if (multiline)
            {
                result.Insert(0, expr + ": " + Environment.NewLine);
            }
            else if (result.Length > 0)
            {
                result.Insert(0, expr + ": ");
            }
            else
            {
                result.Append(expr);
                result.Append(": ");
                result.Append("<unknown type>");
            }

            quickInfoContent.Add(result.ToString());
        }