/// <summary> /// Updates the adornment with the variable information /// </summary> /// <param name="sender">event source</param> /// <param name="e">event arguments</param> public void UpdateAdornment(Object sender, MouseHoverEventArgs e) { if (debugger.CurrentMode != dbgDebugMode.dbgBreakMode || "TypeScript" != dte?.ActiveDocument?.Language) { return; } if (root.IsMouseOver) { return; } var variable = DebuggerVariable.FindUnderMousePointer(debugger, e); if (variable != null) { var position = GetVariablePosition(variable); if (position != null) { MoveAdornment(position.Item1, position.Item2); var newTreeView = TreeViewBuilder.GetTreeView(variable.Expression); currentExpression = variable.Expression; root.ResultTreeView.Items.Clear(); foreach (var item in newTreeView.Items) { root.ResultTreeView.Items.Add(item); } } } else { MoveAdornment(9999, 9999); } }
/// <summary> /// Gets the position of the given debugger variable. /// </summary> /// <param name="variable">Variable to get the position of</param> /// <returns>(Left,Top) coordinate location of the variable</returns> private Tuple <double, double> GetVariablePosition(DebuggerVariable variable) { var markerGeometry = view.TextViewLines.GetMarkerGeometry(variable.Span); var line = view.GetTextViewLineContainingBufferPosition(variable.Span.Start); var left = Math.Max(0, markerGeometry.Bounds.Left - AdornmentLeftOffset); var top = line.Top - root.ActualHeight; return(new Tuple <double, double>(left, top)); }
/// <summary> /// Adds a variable to the Visual Studio watch window. /// </summary> /// <param name="var"></param> private void AddToWatch(DebuggerVariable var) { throw new NotImplementedException("Not yet implemented."); }