display file icon in tab
This commit is contained in:
@@ -8,6 +8,7 @@ using SharpIDE.Application.Features.Run;
|
|||||||
using SharpIDE.Application.Features.SolutionDiscovery;
|
using SharpIDE.Application.Features.SolutionDiscovery;
|
||||||
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
||||||
using SharpIDE.Godot.Features.IdeSettings;
|
using SharpIDE.Godot.Features.IdeSettings;
|
||||||
|
using SharpIDE.Godot.Features.SolutionExplorer;
|
||||||
|
|
||||||
namespace SharpIDE.Godot.Features.CodeEditor;
|
namespace SharpIDE.Godot.Features.CodeEditor;
|
||||||
|
|
||||||
@@ -98,7 +99,7 @@ public partial class CodeEditorPanel : MarginContainer
|
|||||||
{
|
{
|
||||||
_tabContainer.AddChild(newTab);
|
_tabContainer.AddChild(newTab);
|
||||||
var newTabIndex = _tabContainer.GetTabCount() - 1;
|
var newTabIndex = _tabContainer.GetTabCount() - 1;
|
||||||
_tabContainer.SetTabIcon(newTabIndex, CsFileTexture);
|
_tabContainer.SetIconsForFileExtension(file, newTabIndex);
|
||||||
_tabContainer.SetTabTitle(newTabIndex, file.Name);
|
_tabContainer.SetTabTitle(newTabIndex, file.Name);
|
||||||
_tabContainer.SetTabTooltip(newTabIndex, file.Path);
|
_tabContainer.SetTabTooltip(newTabIndex, file.Path);
|
||||||
_tabContainer.CurrentTab = newTabIndex;
|
_tabContainer.CurrentTab = newTabIndex;
|
||||||
@@ -156,3 +157,18 @@ public partial class CodeEditorPanel : MarginContainer
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file static class TabContainerExtensions
|
||||||
|
{
|
||||||
|
extension(TabContainer tabContainer)
|
||||||
|
{
|
||||||
|
public void SetIconsForFileExtension(SharpIdeFile file, int newTabIndex)
|
||||||
|
{
|
||||||
|
var (icon, overlayIcon) = FileIconHelper.GetIconForFileExtension(file.Extension);
|
||||||
|
tabContainer.SetTabIcon(newTabIndex, icon);
|
||||||
|
|
||||||
|
// Unfortunately TabContainer doesn't have a SetTabIconOverlay method
|
||||||
|
//tabContainer.SetIconOverlay(0, overlayIcon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user