Fix rendering error underlines

This commit is contained in:
Matt Parker
2026-01-27 22:39:22 +10:00
parent d3c7f35b14
commit 9e852e5e87
3 changed files with 61 additions and 2 deletions

View File

@@ -35,6 +35,8 @@ public partial class SharpIdeCodeEdit : CodeEdit
private CustomHighlighter _syntaxHighlighter = new();
private PopupMenu _popupMenu = null!;
private CanvasItem _aboveCanvasItem = null!;
private Rid? _aboveCanvasItemRid = null!;
private ImmutableArray<SharpIdeDiagnostic> _fileDiagnostics = [];
private ImmutableArray<SharpIdeDiagnostic> _fileAnalyzerDiagnostics = [];
@@ -63,6 +65,9 @@ public partial class SharpIdeCodeEdit : CodeEdit
{
SyntaxHighlighter = _syntaxHighlighter;
_popupMenu = GetNode<PopupMenu>("CodeFixesMenu");
_aboveCanvasItem = GetNode<CanvasItem>("%AboveCanvasItem");
_aboveCanvasItemRid = _aboveCanvasItem.GetCanvasItem();
RenderingServer.Singleton.CanvasItemSetParent(_aboveCanvasItemRid.Value, GetCanvasItem());
_popupMenu.IdPressed += OnCodeFixSelected;
CustomCodeCompletionRequested.Subscribe(OnCodeCompletionRequested);
CodeFixesRequested += OnCodeFixesRequested;
@@ -363,8 +368,9 @@ public partial class SharpIdeCodeEdit : CodeEdit
{
endPos.X += 10;
}
DrawDashedLine(startPos, endPos, color, thickness);
//DrawLine(startPos, endPos, color, thickness);
RenderingServer.Singleton.CanvasItemClear(_aboveCanvasItemRid!.Value);
RenderingServer.Singleton.DrawDashedLine(_aboveCanvasItemRid!.Value, startPos, endPos, color, thickness);
}
public override void _Draw()
{

View File

@@ -43,3 +43,9 @@ size = Vector2i(217, 100)
item_count = 1
item_0/text = "Getting Context Actions..."
item_0/id = 0
[node name="AboveCanvasItem" type="Control" parent="." unique_id=650087366]
unique_name_in_owner = true
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0