internal static DebuggerVariable FindUnderMousePointer(EnvDTE.Debugger debugger, MouseHoverEventArgs e) { Debug.Assert(debugger != null); var point = e.TextPosition.GetPoint(e.TextPosition.AnchorBuffer, PositionAffinity.Predecessor); if (!point.HasValue) { return(null); } SnapshotSpan span; var name = GetVariableNameAndSpan(point.Value, out span); if (name == null) { return(null); } var expression = debugger.GetExpression(name); if (!expression.IsValidValue) { return(null); } return(new DebuggerVariable(debugger, point.Value, span, name, expression)); }
internal string GetMemberString(string name) { var expression = debugger.GetExpression(this.Name + "." + name); // ex: "bitmap.ColorMode", "bitmap.Dimensions.Width", "bitmap.Buffers[0].Pitch" if (!expression.IsValidValue) { return(null); } else { if (expression.Type == "string") { return(expression.Value.Substring(1, expression.Value.Length - 2)); // Remove '"' string quotes at the beginning and the end } else { return(expression.Value); } } }
public void Evaluate(EnvDTE.Debugger debugger) { ThreadHelper.ThrowIfNotOnUIThread(); Value = "<Unknown value>"; if (IsLiteral) { Value = Expression; return; } try { if (debugger != null) { EnvDTE.Expression expr = debugger.GetExpression(Expression, true); if (expr != null) { Value = expr.Value; Type = expr.Type; } if (UseAddressForName) { EnvDTE.Expression nameExpr = debugger.GetExpression("&" + Expression, false); if (nameExpr != null) { Name = nameExpr.Value; } } } } catch (Exception e) { Value = "Exception thrown: " + e.Message; } }
public DebuggerScriptResultList FilterNotString(string filter, string ExpectedValue, EnvDTE.Debugger debugger) { ThreadHelper.ThrowIfNotOnUIThread(); DebuggerScriptResultList newResults = new DebuggerScriptResultList(); foreach (var result in Results) { var expr = debugger.GetExpression(string.Format(filter, "(" + result.Expression + ")"), true); if (expr != null && ExtractString(expr.Value) != ExpectedValue) { newResults.Add(result.Name, result.Expression, result.Index); } } return(newResults); }
public Common.Expression GetExpression(string expressionText) => new Common.Expression(_debugger.GetExpression(expressionText));