Skip to content

Finalize shell integration sequences #155639

Closed

Description

This issue tracks cleaning up the shell integration sequences, documenting and encouraging third parties to use the sequences.

Possible users:

Some things to look into:

  • The continuation (F, G) and right prompt (H, I) sequences are not thoroughly tested, we should investigate whether we need these at all considering.
  • Review and document all known properties (P)?
    • Should we support one of the common cwd properties instead of roll our own? Hostname and different sequences for different operating systems were some of the complications here.
    • How should cwds be treated in ssh where VS Code's shell integration is installed?
    • The Task should should be more generic
  • Improve command line (E) serialization of special characters
  • Should 633 A-D be removed in favor of 133 A-D? p10k works in a degraded state when sending these, if it also sent E (and P?) would it be fully functional?

The current sequences are lightly documented in code here:

/**
* VS Code-specific shell integration sequences. Some of these are based on common alternatives like
* those pioneered in FinalTerm. The decision to move to entirely custom sequences was to try to
* improve reliability and prevent the possibility of applications confusing the terminal.
*/
const enum VSCodeOscPt {
/**
* The start of the prompt, this is expected to always appear at the start of a line.
* Based on FinalTerm's `OSC 133 ; A ST`.
*/
PromptStart = 'A',
/**
* The start of a command, ie. where the user inputs their command.
* Based on FinalTerm's `OSC 133 ; B ST`.
*/
CommandStart = 'B',
/**
* Sent just before the command output begins.
* Based on FinalTerm's `OSC 133 ; C ST`.
*/
CommandExecuted = 'C',
/**
* Sent just after a command has finished. The exit code is optional, when not specified it
* means no command was run (ie. enter on empty prompt or ctrl+c).
* Based on FinalTerm's `OSC 133 ; D [; <ExitCode>] ST`.
*/
CommandFinished = 'D',
/**
* Explicitly set the command line. This helps workaround problems with conpty not having a
* passthrough mode by providing an option on Windows to send the command that was run. With
* this sequence there's no need for the guessing based on the unreliable cursor positions that
* would otherwise be required.
*/
CommandLine = 'E',
/**
* Similar to prompt start but for line continuations.
*/
ContinuationStart = 'F',
/**
* Similar to command start but for line continuations.
*/
ContinuationEnd = 'G',
/**
* The start of the right prompt.
*/
RightPromptStart = 'H',
/**
* The end of the right prompt.
*/
RightPromptEnd = 'I',
/**
* Set an arbitrary property: `OSC 633 ; P ; <Property>=<Value> ST`, only known properties will
* be handled.
*/
Property = 'P'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

debtCode quality issuesterminal-shell-integrationShell integration, command decorations, etc.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions