public void render()

in plugin/src/software/aws/toolkits/eclipse/amazonq/util/QInlineSuggestionCloseBracketSegment.java [59:109]


    public void render(final GC gc, final int currentCaretOffset) {
        if (currentCaretOffset > caretOffset) {
            return;
        }
        var qInvocationSessionInstance = QInvocationSession.getInstance();
        if (qInvocationSessionInstance == null) {
            return;
        }
        var widget = qInvocationSessionInstance.getViewer().getTextWidget();

        int x;
        int y;
        int invocationOffset = qInvocationSessionInstance.getInvocationOffset();
        int invocationLine = widget.getLineAtOffset(invocationOffset);
        int lineHt = widget.getLineHeight();
        int fontHt = gc.getFontMetrics().getHeight();
        y = (invocationLine + lineInSuggestion + 1) * lineHt - fontHt;
        x = isMacOS ? gc.textExtent(text).x : (int) measureLayout.getBounds().width;
        if (lineInSuggestion == 0) {
            x += widget.getLocationAtOffset(invocationOffset).x;
        }
        int scrollOffsetY = widget.getTopPixel();
        y -= scrollOffsetY;
        String textToRender = String.valueOf(symbol);
        if (currentCaretOffset > openBracket.getRelevantOffset()) {
            Color typedColor = widget.getForeground();
            if (isMacOS) {
                gc.setForeground(typedColor);
                gc.setFont(adjustedTypedFont);
                gc.drawText(textToRender, x, y, false);
            } else {
                layout.setFont(adjustedTypedFont);
                layout.setText(textToRender);
                layout.setTabs(widget.getTabStops());
                gc.setAlpha(255);
                layout.draw(gc, x, y);
            }
        } else {
            if (isMacOS) {
                gc.setForeground(Q_INLINE_HINT_TEXT_COLOR);
                gc.setFont(qInvocationSessionInstance.getInlineTextFont());
                gc.drawText(textToRender, x, y, true);
            } else {
                layout.setFont(qInvocationSessionInstance.getInlineTextFont());
                layout.setText(textToRender);
                layout.setTabs(widget.getTabStops());
                gc.setAlpha(127);
                layout.draw(gc, x, y);
            }
        }
    }