KetraTerm
API · v0.2.2All versions

SwingLiveCompletionBinding

Binds host-neutral live-completion behavior to one Swing terminal.

The binding observes dedicated shell-edit revisions, applies the shared debounce policy, adapts shell snapshots to Swing requests, hides suggestions when focus leaves the terminal, and invalidates request deduplication after user feedback. It owns only its observation job; completion providers, enablement, ranking context, and feedback persistence remain host supplied.

Construct the binding before the terminal so suggestionFeedbackHandler can be passed through io.github.ketraterm.ui.swing.api.SwingHostServices. After binding the terminal to the session, call attach. Call close from the EDT before disposing the terminal.

Constructors

Link copied to clipboard
constructor(session: TerminalSession, coroutineScope: CoroutineScope, suggestionsEnabled: () -> Boolean, rankingContextKey: () -> String? = { null }, feedbackHandler: SwingShellSuggestionFeedbackHandler = SwingShellSuggestionFeedbackHandler.NONE)

Creates a live-completion binding for session.

Properties

Link copied to clipboard

Feedback callback to install in the terminal's host services.

Functions

Link copied to clipboard
fun attach(terminal: SwingTerminal)

Attaches this binding to terminal and observes shell-edit revisions.

Link copied to clipboard

Cancels pending live completion and hides the current popup.

Link copied to clipboard
open override fun close()

Stops observation, removes focus wiring, and hides suggestions.

Link copied to clipboard
fun detach()

Stops automatic observation without dismissing an explicit completion request.

Link copied to clipboard

Re-evaluates live completion after the shared debounce interval.