show editor hover info without editor focus

This commit is contained in:
Matt Parker
2026-01-28 00:37:20 +10:00
parent 2251e1efac
commit f31b9e1fcc
2 changed files with 1 additions and 3 deletions

View File

@@ -79,7 +79,6 @@ public partial class SharpIdeCodeEdit : CodeEdit
SymbolValidate += OnSymbolValidate;
SymbolLookup += OnSymbolLookup;
LinesEditedFrom += OnLinesEditedFrom;
MouseEntered += () => GrabFocus(true); // fixes symbol hover not appearing when e.g. solution explorer is focused. Same as godot editor
GlobalEvents.Instance.SolutionAltered.Subscribe(OnSolutionAltered);
SetCodeRegionTags("#region", "#endregion");
//AddGitGutter();

View File

@@ -18,8 +18,7 @@ public partial class SharpIdeCodeEdit
// This method is a bit of a disaster - we create an additional invisible Window, so that the tooltip window doesn't disappear while the mouse is over the hovered symbol
private async void OnSymbolHovered(string symbol, long line, long column)
{
if (HasFocus() is false)
return; // only show if we have focus, every tab is currently listening for this event, maybe find a better way
if (Visible is false) return; // This should never return false, as this signal should not be emitted when this SharpIdeCodeEdit is not the selected tab, ie the control is not visible
var globalMousePosition = GetGlobalMousePosition(); // don't breakpoint before this, else your mouse position will be wrong
var lineHeight = GetLineHeight();
GD.Print($"Symbol hovered: {symbol} at line {line}, column {column}");