setGhostText method

void setGhostText(
  1. GhostText? ghostText
)

Sets the ghost text (inline suggestion) at a specific position.

Ghost text appears as semi-transparent text, typically used for AI code completion suggestions. Only one ghost text can be active.

Example:

controller.setGhostText(GhostText(
  line: 10,
  column: 15,
  text: 'print("Hello, World!");',
  style: TextStyle(
    color: Colors.grey.withOpacity(0.5),
    fontStyle: FontStyle.italic,
  ),
));

Pass null to clear the ghost text.

Implementation

void setGhostText(GhostText? ghostText) {
  _ghostText = ghostText;
  decorationsChanged = true;
  notifyListeners();
}