KetraTerm
API · DevelopmentAll versions

TerminalCompletionContext

One parsed, spec-resolved completion context shared by every source.

The merged engine constructs this object once per request through resolve. Custom engines use the same operation with their own command catalog. Source implementations consume it directly to determine eligibility, prefix matching, replacement ranges, and semantic argument kinds without re-tokenizing the command line. Context-owned collections reject mutation and are never reused by later requests. Command specifications remain catalog-owned; keep their nested collections unchanged while any context referencing them is in use.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

specification of the option whose value is being completed, or null when not completing an option value.

Link copied to clipboard

semantic position of the active completion token (e.g. COMMAND, SUBCOMMAND, OPTION_NAME, OPTION_VALUE, POSITIONAL_ARGUMENT, OPERATOR).

Link copied to clipboard

positional argument specification active at the cursor, or null if unspecified or variadic limit reached.

Link copied to clipboard

decoded prefix text that candidates must match, taking attached option value prefixes (--key=val) into account.

Link copied to clipboard

quote character enclosing the active token (' or "), or the null character \u0000 when unquoted.

Link copied to clipboard

matched root command specification, or null for unknown commands.

Link copied to clipboard

matched root-to-leaf command specification path reflecting the active subcommand hierarchy.

Link copied to clipboard

token index of the executable in the active command segment.

Link copied to clipboard

deepest matched command specification in commandPath, or null when no command spec was matched.

Link copied to clipboard

hidden-entry policy expected at the cursor.

Link copied to clipboard

file-system path kind expected at the cursor (e.g. FILE, DIRECTORY, FILE_OR_DIRECTORY, or NONE).

Link copied to clipboard

dynamic host-provided value domain expected at the cursor (e.g. GIT_BRANCH, ENVIRONMENT_VARIABLE, or NONE).

Link copied to clipboard

whether a -- token terminated option parsing before the cursor.

Link copied to clipboard

Decoded words after the executable and strictly before the active token, in input order. Includes subcommands, option names, values, and --. Leading environment assignments and the executable are excluded. Available even without a command spec; empty at command/operator positions.

Link copied to clipboard

Decoded preceding positional values in input order, using the matched command spec's analysis. Excludes resolved subcommands, option names, option values, and the option terminator. After --, words are positional. Empty when the command is unknown; use precedingArguments in that case. Unknown options have no inferred value ownership. The immutable list has the same segment, active-word exclusion, and lifetime as precedingArguments.

Link copied to clipboard

exclusive UTF-16 replacement end offset in the original request command line.

Link copied to clipboard

inclusive UTF-16 replacement start offset in the original request command line.

Link copied to clipboard

static candidate values declared by the active option or positional argument specification.

Link copied to clipboard

command specification whose subcommands are eligible for completion at the cursor.

Link copied to clipboard

identifiers of exclusive option groups already supplied before the cursor.

Functions

Link copied to clipboard

Returns every completed value for a known option in input order, including repeats and empty values. optionName may be any declared alias; matching follows command-spec lookup (trimmed and case-insensitive). Separate values and --name=value use the same resolved option and decoded value semantics.