Skip to content

Conversation

@Tyriar
Copy link
Member

@Tyriar Tyriar commented Oct 27, 2025

No description provided.

@Tyriar Tyriar added this to the October 2025 milestone Oct 27, 2025
@Tyriar Tyriar self-assigned this Oct 27, 2025
Copilot AI review requested due to automatic review settings October 27, 2025 20:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR explores generating a TypeScript type ITerminalConfiguration2 automatically from the terminal configuration JSON schema, eliminating the need to manually maintain a separate type definition. The approach uses the TypeFromJsonSchema utility type to derive types from the configuration schema at compile time.

Key changes:

  • Adds TypeFromJsonSchema import from the JSON schema utilities
  • Converts terminalConfiguration to use as const satisfies pattern to preserve literal types
  • Creates ITerminalConfiguration2 type that derives types from the schema with key transformation

const terminalConfiguration = terminalConfigurationConst as IStringDictionary<IConfigurationPropertySchema>;

export type ITerminalConfiguration2 = {
// [K in keyof typeof terminalConfiguration]: TypeFromJsonSchema<typeof terminalConfiguration[K]>
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type definition contains a commented-out alternative implementation on line 668. This commented code should be removed to keep the codebase clean, or if it represents a different approach worth preserving, it should be documented why both versions are present.

Suggested change
// [K in keyof typeof terminalConfiguration]: TypeFromJsonSchema<typeof terminalConfiguration[K]>

Copilot uses AI. Check for mistakes.
Comment on lines 683 to 698
// const b = {
// markdownDescription: localize('terminal.integrated.persistentSessionReviveProcess', "When the terminal process must be shut down (for example on window or application close), this determines when the previous terminal session contents/history should be restored and processes be recreated when the workspace is next opened.\n\nCaveats:\n\n- Restoring of the process current working directory depends on whether it is supported by the shell.\n- Time to persist the session during shutdown is limited, so it may be aborted when using high-latency remote connections."),
// type: 'string',
// enum: ['onExit', 'onExitAndWindowClose', 'never'],
// markdownEnumDescriptions: [
// localize('terminal.integrated.persistentSessionReviveProcess.onExit', "Revive the processes after the last window is closed on Windows/Linux or when the `workbench.action.quit` command is triggered (command palette, keybinding, menu)."),
// localize('terminal.integrated.persistentSessionReviveProcess.onExitAndWindowClose', "Revive the processes after the last window is closed on Windows/Linux or when the `workbench.action.quit` command is triggered (command palette, keybinding, menu), or when the window is closed."),
// localize('terminal.integrated.persistentSessionReviveProcess.never', "Never restore the terminal buffers or recreate the process.")
// ],
// default: 'onExit'
// } as const satisfies IConfigurationPropertySchema;,

// type A = TypeFromJsonSchema<typeof b>;

// const a: A;

Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this commented-out test/debugging code (lines 672-697). This appears to be exploratory code used during development that should not be committed to the codebase.

Suggested change
// const b = {
// markdownDescription: localize('terminal.integrated.persistentSessionReviveProcess', "When the terminal process must be shut down (for example on window or application close), this determines when the previous terminal session contents/history should be restored and processes be recreated when the workspace is next opened.\n\nCaveats:\n\n- Restoring of the process current working directory depends on whether it is supported by the shell.\n- Time to persist the session during shutdown is limited, so it may be aborted when using high-latency remote connections."),
// type: 'string',
// enum: ['onExit', 'onExitAndWindowClose', 'never'],
// markdownEnumDescriptions: [
// localize('terminal.integrated.persistentSessionReviveProcess.onExit', "Revive the processes after the last window is closed on Windows/Linux or when the `workbench.action.quit` command is triggered (command palette, keybinding, menu)."),
// localize('terminal.integrated.persistentSessionReviveProcess.onExitAndWindowClose', "Revive the processes after the last window is closed on Windows/Linux or when the `workbench.action.quit` command is triggered (command palette, keybinding, menu), or when the window is closed."),
// localize('terminal.integrated.persistentSessionReviveProcess.never', "Never restore the terminal buffers or recreate the process.")
// ],
// default: 'onExit'
// } as const satisfies IConfigurationPropertySchema;,
// type A = TypeFromJsonSchema<typeof b>;
// const a: A;

Copilot uses AI. Check for mistakes.
@Tyriar Tyriar modified the milestones: October 2025, November 2025 Oct 28, 2025
@Tyriar
Copy link
Member Author

Tyriar commented Oct 28, 2025

To re-evaluate during a debt week

@Tyriar
Copy link
Member Author

Tyriar commented Nov 3, 2025

While this is cool, the types are getting a little too complex for comfort

@Tyriar Tyriar closed this Nov 3, 2025
@Tyriar Tyriar deleted the tyriar/json_config branch November 3, 2025 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants