Exemplo n.º 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<IAnalysisValue> listVars = new List<IAnalysisValue>(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;
                    }
                }

                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, 4096) + "...";
            }
            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("<no type information available>");
            }

            quickInfoContent.Add(result.ToString());
        }
Exemplo n.º 2
0
 public PreviewChangesEngine(IRenameVariableInput input, ExpressionAnalysis analysis, RenameVariableRequest request, string originalName, string privatePrefix, VsProjectAnalyzer analyzer, IEnumerable<IAnalysisVariable> variables)
 {
     _analysis = analysis;
     _analyzer = analyzer;
     _renameReq = request;
     _originalName = originalName;
     _privatePrefix = privatePrefix;
     _variables = variables;
     _input = input;
     _list = new PreviewList(CreatePreviewItems().ToArray());
 }
Exemplo n.º 3
0
        public override IVsSimpleObjectList2 DoSearch(VSOBSEARCHCRITERIA2 criteria)
        {
            var node = _hierarchy as JFileNode;
            if(node != null) {
                var analysis = node.GetAnalysis() as IJProjectEntry;

                if (analysis != null) {
                    var exprAnalysis = new ExpressionAnalysis(
                        ((JProjectNode)node.ProjectMgr).GetAnalyzer(),
                        criteria.szName.Substring(criteria.szName.LastIndexOf(':') + 1),
                        analysis.Analysis,
                        0,
                        null
                    );

                    return EditFilter.GetFindRefLocations(exprAnalysis);
                }
            }

            return null;
        }