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.
Properties
specification of the option whose value is being completed, or null when not completing an option value.
semantic position of the active completion token (e.g. COMMAND, SUBCOMMAND, OPTION_NAME, OPTION_VALUE, POSITIONAL_ARGUMENT, OPERATOR).
positional argument specification active at the cursor, or null if unspecified or variadic limit reached.
decoded prefix text that candidates must match, taking attached option value prefixes (--key=val) into account.
quote character enclosing the active token (' or "), or the null character \u0000 when unquoted.
matched root command specification, or null for unknown commands.
matched root-to-leaf command specification path reflecting the active subcommand hierarchy.
token index of the executable in the active command segment.
deepest matched command specification in commandPath, or null when no command spec was matched.
hidden-entry policy expected at the cursor.
file-system path kind expected at the cursor (e.g. FILE, DIRECTORY, FILE_OR_DIRECTORY, or NONE).
dynamic host-provided value domain expected at the cursor (e.g. GIT_BRANCH, ENVIRONMENT_VARIABLE, or NONE).
whether a -- token terminated option parsing before the cursor.
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.
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.
exclusive UTF-16 replacement end offset in the original request command line.
inclusive UTF-16 replacement start offset in the original request command line.
static candidate values declared by the active option or positional argument specification.
command specification whose subcommands are eligible for completion at the cursor.
identifiers of exclusive option groups already supplied before the cursor.
Functions
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.