Skip to content

Commit

Permalink
Added variable value info on hover
Browse files Browse the repository at this point in the history
  • Loading branch information
X39 committed Apr 15, 2020
1 parent 60b6b53 commit fb128aa
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Arma.Studio/UI/TextEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@
<TextBlock Grid.Column="5" Text="{Binding Description}" VerticalAlignment="Center"/>
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type asd:VariableInfo}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="4"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="4"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding Data}" VerticalAlignment="Center" FontSize="12"/>
<TextBlock Grid.Column="2" Text="{Binding DataType}" VerticalAlignment="Center" FontSize="10" Opacity="0.5"/>
<TextBlock Grid.Column="4" Text="{Binding ScopeName, StringFormat='{}(scope `{0}` '}" VerticalAlignment="Center" FontSize="10" Opacity="0.5"/>
<TextBlock Grid.Column="5" Text="{Binding ScopeIndex, StringFormat='{} {0}'}" VerticalAlignment="Center" FontSize="10" Opacity="0.5"/>
<TextBlock Grid.Column="6" Text="{Binding VariableName, StringFormat='{} with {0})'}" VerticalAlignment="Center" Opacity="0.5"/>
</Grid>
</DataTemplate>
</ae:TextEditor.Resources>
</ae:TextEditor>
</DataTemplate>
9 changes: 9 additions & 0 deletions Arma.Studio/UI/TextEditorDataContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,15 @@ private void TextEditor_MouseHover(object sender, MouseEventArgs e)
{
this.ToolTip.Content = lintInfo;
}
else if (!String.IsNullOrWhiteSpace(word) && App.MWContext.Debugger != null && App.MWContext.Debugger.State != Data.Debugging.EDebugState.NA)
{
var variable = App.MWContext.Debugger.GetLocalVariables().FirstOrDefault((it) => it.VariableName.Equals(word, StringComparison.InvariantCultureIgnoreCase));
if (variable is null)
{
variable = App.MWContext.Debugger.GetVariable(word, Data.Debugging.ENamespace.MissionNamespace);
}
this.ToolTip.Content = variable;
}
}
private void TextEditor_MouseHoverStopped(object sender, MouseEventArgs e)
{
Expand Down

0 comments on commit fb128aa

Please sign in to comment.