refactor common code

This commit is contained in:
Matt Parker
2025-10-12 23:29:57 +10:00
parent c96fa9308a
commit d73187fde3
8 changed files with 4 additions and 21 deletions

View File

@@ -183,6 +183,10 @@ public partial class SharpIdeCodeEdit : CodeEdit
ILocalSymbol localSymbol => SymbolInfoComponents.GetLocalVariableSymbolInfo(localSymbol),
_ => SymbolInfoComponents.GetUnknownTooltip(roslynSymbol)
};
symbolInfoNode.FitContent = true;
symbolInfoNode.AutowrapMode = TextServer.AutowrapMode.Off;
symbolInfoNode.SetAnchorsPreset(Control.LayoutPreset.FullRect);
panel.AddChild(symbolInfoNode);
var vboxContainer = new VBoxContainer();
vboxContainer.AddThemeConstantOverride("separation", 0);

View File

@@ -13,9 +13,6 @@ public static partial class SymbolInfoComponents
public static RichTextLabel GetUnknownTooltip(ISymbol symbol)
{
var label = new RichTextLabel();
label.FitContent = true;
label.AutowrapMode = TextServer.AutowrapMode.Off;
label.SetAnchorsPreset(Control.LayoutPreset.FullRect);
label.PushColor(CachedColors.White);
label.PushFont(MonospaceFont);
label.AddText($"UNHANDLED SYMBOL TYPE: {symbol.GetType().Name} - please create an issue!");

View File

@@ -8,9 +8,6 @@ public static partial class SymbolInfoComponents
public static RichTextLabel GetFieldSymbolInfo(IFieldSymbol symbol)
{
var label = new RichTextLabel();
label.FitContent = true;
label.AutowrapMode = TextServer.AutowrapMode.Off;
label.SetAnchorsPreset(Control.LayoutPreset.FullRect);
label.PushColor(CachedColors.White);
label.PushFont(MonospaceFont);
label.AddAttributes(symbol);

View File

@@ -8,9 +8,6 @@ public static partial class SymbolInfoComponents
public static RichTextLabel GetLocalVariableSymbolInfo(ILocalSymbol symbol)
{
var label = new RichTextLabel();
label.FitContent = true;
label.AutowrapMode = TextServer.AutowrapMode.Off;
label.SetAnchorsPreset(Control.LayoutPreset.FullRect);
label.PushColor(CachedColors.White);
label.PushFont(MonospaceFont);
label.AddAttributes(symbol);

View File

@@ -8,9 +8,6 @@ public static partial class SymbolInfoComponents
public static RichTextLabel GetMethodSymbolInfo(IMethodSymbol methodSymbol)
{
var label = new RichTextLabel();
label.FitContent = true;
label.AutowrapMode = TextServer.AutowrapMode.Off;
label.SetAnchorsPreset(Control.LayoutPreset.FullRect);
label.PushColor(CachedColors.White);
label.PushFont(MonospaceFont);
label.AddAttributes(methodSymbol);

View File

@@ -8,9 +8,6 @@ public static partial class SymbolInfoComponents
public static RichTextLabel GetNamedTypeSymbolInfo(INamedTypeSymbol symbol)
{
var label = new RichTextLabel();
label.FitContent = true;
label.AutowrapMode = TextServer.AutowrapMode.Off;
label.SetAnchorsPreset(Control.LayoutPreset.FullRect);
label.PushColor(CachedColors.White);
label.PushFont(MonospaceFont);
label.AddAttributes(symbol);

View File

@@ -8,9 +8,6 @@ public static partial class SymbolInfoComponents
public static RichTextLabel GetParameterSymbolInfo(IParameterSymbol symbol)
{
var label = new RichTextLabel();
label.FitContent = true;
label.AutowrapMode = TextServer.AutowrapMode.Off;
label.SetAnchorsPreset(Control.LayoutPreset.FullRect);
label.PushColor(CachedColors.White);
label.PushFont(MonospaceFont);
label.AddAttributes(symbol);

View File

@@ -8,9 +8,6 @@ public partial class SymbolInfoComponents
public static RichTextLabel GetPropertySymbolInfo(IPropertySymbol symbol)
{
var label = new RichTextLabel();
label.FitContent = true;
label.AutowrapMode = TextServer.AutowrapMode.Off;
label.SetAnchorsPreset(Control.LayoutPreset.FullRect);
label.PushColor(CachedColors.White);
label.PushFont(MonospaceFont);
label.AddAttributes(symbol);