Fix: make ctrl+x use preferred editor (#16556)

This commit is contained in:
Tommaso Sciortino
2026-01-13 16:55:07 -08:00
committed by GitHub
parent 778de55fd8
commit 8dbaa2bcea
3 changed files with 81 additions and 58 deletions
+11 -6
View File
@@ -112,6 +112,16 @@ export function checkHasEditorType(editor: EditorType): boolean {
return commands.some((cmd) => commandExists(cmd));
}
export function getEditorCommand(editor: EditorType): string {
const commandConfig = editorCommands[editor];
const commands =
process.platform === 'win32' ? commandConfig.win32 : commandConfig.default;
return (
commands.slice(0, -1).find((cmd) => commandExists(cmd)) ||
commands[commands.length - 1]
);
}
export function allowEditorTypeInSandbox(editor: EditorType): boolean {
const notUsingSandbox = !process.env['SANDBOX'];
if (isGuiEditor(editor)) {
@@ -143,12 +153,7 @@ export function getDiffCommand(
if (!isValidEditorType(editor)) {
return null;
}
const commandConfig = editorCommands[editor];
const commands =
process.platform === 'win32' ? commandConfig.win32 : commandConfig.default;
const command =
commands.slice(0, -1).find((cmd) => commandExists(cmd)) ||
commands[commands.length - 1];
const command = getEditorCommand(editor);
switch (editor) {
case 'vscode':