Skip to content

Commit 00d7519

Browse files
change defailt for new termial
1 parent 6de0ca3 commit 00d7519

3 files changed

Lines changed: 12 additions & 17 deletions

File tree

‎KEYBINDINGS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ See the full schema for more details: [`packages/contracts/src/keybindings.ts`](
2121
[
2222
{ "key": "mod+j", "command": "terminal.toggle" },
2323
{ "key": "mod+d", "command": "terminal.split", "when": "terminalFocus" },
24-
{ "key": "mod+shift+d", "command": "terminal.new", "when": "terminalFocus" },
24+
{ "key": "mod+n", "command": "terminal.new", "when": "terminalFocus" },
2525
{ "key": "mod+shift+o", "command": "chat.new" },
2626
{ "key": "mod+o", "command": "editor.openFavorite" }
2727
]

‎apps/server/src/keybindings.ts‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type WhenToken =
2727
export const DEFAULT_KEYBINDINGS: ReadonlyArray<KeybindingRule> = [
2828
{ key: "mod+j", command: "terminal.toggle" },
2929
{ key: "mod+d", command: "terminal.split", when: "terminalFocus" },
30-
{ key: "mod+shift+d", command: "terminal.new", when: "terminalFocus" },
30+
{ key: "mod+n", command: "terminal.new", when: "terminalFocus" },
3131
{ key: "mod+shift+o", command: "chat.new" },
3232
{ key: "mod+o", command: "editor.openFavorite" },
3333
];
@@ -39,7 +39,10 @@ function normalizeKeyToken(token: string): string {
3939
}
4040

4141
export function parseKeybindingShortcut(value: string): KeybindingShortcut | null {
42-
const rawTokens = value.toLowerCase().split("+").map((token) => token.trim());
42+
const rawTokens = value
43+
.toLowerCase()
44+
.split("+")
45+
.map((token) => token.trim());
4346
const tokens = [...rawTokens];
4447
let trailingEmptyCount = 0;
4548
while (tokens[tokens.length - 1] === "") {
@@ -220,9 +223,7 @@ export function parseKeybindingWhenExpression(expression: string): KeybindingWhe
220223
return ast;
221224
}
222225

223-
export function compileResolvedKeybindingRule(
224-
rule: KeybindingRule,
225-
): ResolvedKeybindingRule | null {
226+
export function compileResolvedKeybindingRule(rule: KeybindingRule): ResolvedKeybindingRule | null {
226227
const key = rule.key.trim();
227228
if (key.length === 0) return null;
228229
const shortcut = parseKeybindingShortcut(key);
@@ -271,9 +272,7 @@ function compileDefaultKeybindings(): ResolvedKeybindingsConfig {
271272

272273
const DEFAULT_RESOLVED_KEYBINDINGS = compileDefaultKeybindings();
273274

274-
function mergeWithDefaultKeybindings(
275-
custom: ResolvedKeybindingsConfig,
276-
): ResolvedKeybindingsConfig {
275+
function mergeWithDefaultKeybindings(custom: ResolvedKeybindingsConfig): ResolvedKeybindingsConfig {
277276
if (custom.length === 0) {
278277
return [...DEFAULT_RESOLVED_KEYBINDINGS];
279278
}

‎apps/server/src/wsServer.test.ts‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ describe("WebSocket Server", () => {
351351
JSON.stringify([
352352
{ key: "cmd+j", command: "terminal.toggle" },
353353
{ key: "mod+d", command: "terminal.split", when: "terminalFocus" },
354-
{ key: "mod+shift+d", command: "terminal.new", when: "terminalFocus" },
354+
{ key: "mod+n", command: "terminal.new", when: "terminalFocus" },
355355
]),
356356
"utf8",
357357
);
@@ -374,7 +374,7 @@ describe("WebSocket Server", () => {
374374
keybindings: mergeWithDefaultsForTest([
375375
{ key: "cmd+j", command: "terminal.toggle" },
376376
{ key: "mod+d", command: "terminal.split", when: "terminalFocus" },
377-
{ key: "mod+shift+d", command: "terminal.new", when: "terminalFocus" },
377+
{ key: "mod+n", command: "terminal.new", when: "terminalFocus" },
378378
]),
379379
});
380380
});
@@ -408,9 +408,7 @@ describe("WebSocket Server", () => {
408408
expect(response.error).toBeUndefined();
409409
expect(response.result).toEqual({
410410
cwd: "/my/workspace",
411-
keybindings: mergeWithDefaultsForTest([
412-
{ key: "mod+j", command: "terminal.toggle" },
413-
]),
411+
keybindings: mergeWithDefaultsForTest([{ key: "mod+j", command: "terminal.toggle" }]),
414412
});
415413
expect(
416414
warnSpy.mock.calls.some(([message]) =>
@@ -479,9 +477,7 @@ describe("WebSocket Server", () => {
479477
expect(firstResponse.error).toBeUndefined();
480478
expect(firstResponse.result).toEqual({
481479
cwd: "/my/workspace",
482-
keybindings: mergeWithDefaultsForTest([
483-
{ key: "cmd+j", command: "terminal.toggle" },
484-
]),
480+
keybindings: mergeWithDefaultsForTest([{ key: "cmd+j", command: "terminal.toggle" }]),
485481
});
486482

487483
fs.writeFileSync(

0 commit comments

Comments
 (0)