/// <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> /// Click handler to generate the string representation and places it in the textbox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GenerateButton_Click(object sender, RoutedEventArgs e) { if (Expression == null) { GeneratedText.Text = "Variable cannot be null."; } else { bool prettyPrintMode = PrettyPrintCheckbox.IsChecked ?? false; GeneratedText.Text = TreeViewBuilder.GetStringRepresentation(Expression, prettyPrintMode) as string; } }