authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-15 14:42:22-08:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-02-15 15:51:05-08:00
log1269b5258097d75f4cb413a0612570a106e32426
tree5d2f5d3734dd58e2766cdac7d57d80c83d1ee10c
parentfe79c8e9ee7471a6d32b9c045a19073c236809e6

change defailt for new termial


3 files changed, 12 insertions(+), 17 deletions(-)

KEYBINDINGS.md+1-1
...@@ -21,7 +21,7 @@ See the full schema for more details: [`packages/contracts/src/keybindings.ts`](...@@ -21,7 +21,7 @@ See the full schema for more details: [`packages/contracts/src/keybindings.ts`](
21[21[
22 { "key": "mod+j", "command": "terminal.toggle" },22 { "key": "mod+j", "command": "terminal.toggle" },
23 { "key": "mod+d", "command": "terminal.split", "when": "terminalFocus" },23 { "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" },
25 { "key": "mod+shift+o", "command": "chat.new" },25 { "key": "mod+shift+o", "command": "chat.new" },
26 { "key": "mod+o", "command": "editor.openFavorite" }26 { "key": "mod+o", "command": "editor.openFavorite" }
27]27]
apps/server/src/keybindings.ts+7-8
...@@ -27,7 +27,7 @@ type WhenToken =...@@ -27,7 +27,7 @@ type WhenToken =
27export const DEFAULT_KEYBINDINGS: ReadonlyArray<KeybindingRule> = [27export const DEFAULT_KEYBINDINGS: ReadonlyArray<KeybindingRule> = [
28 { key: "mod+j", command: "terminal.toggle" },28 { key: "mod+j", command: "terminal.toggle" },
29 { key: "mod+d", command: "terminal.split", when: "terminalFocus" },29 { 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" },
31 { key: "mod+shift+o", command: "chat.new" },31 { key: "mod+shift+o", command: "chat.new" },
32 { key: "mod+o", command: "editor.openFavorite" },32 { key: "mod+o", command: "editor.openFavorite" },
33];33];
...@@ -39,7 +39,10 @@ function normalizeKeyToken(token: string): string {...@@ -39,7 +39,10 @@ function normalizeKeyToken(token: string): string {
39}39}
4040
41export function parseKeybindingShortcut(value: string): KeybindingShortcut | null {41export 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());
43 const tokens = [...rawTokens];46 const tokens = [...rawTokens];
44 let trailingEmptyCount = 0;47 let trailingEmptyCount = 0;
45 while (tokens[tokens.length - 1] === "") {48 while (tokens[tokens.length - 1] === "") {
...@@ -220,9 +223,7 @@ export function parseKeybindingWhenExpression(expression: string): KeybindingWhe...@@ -220,9 +223,7 @@ export function parseKeybindingWhenExpression(expression: string): KeybindingWhe
220 return ast;223 return ast;
221}224}
222225
223export function compileResolvedKeybindingRule(226export function compileResolvedKeybindingRule(rule: KeybindingRule): ResolvedKeybindingRule | null {
224 rule: KeybindingRule,
225): ResolvedKeybindingRule | null {
226 const key = rule.key.trim();227 const key = rule.key.trim();
227 if (key.length === 0) return null;228 if (key.length === 0) return null;
228 const shortcut = parseKeybindingShortcut(key);229 const shortcut = parseKeybindingShortcut(key);
...@@ -271,9 +272,7 @@ function compileDefaultKeybindings(): ResolvedKeybindingsConfig {...@@ -271,9 +272,7 @@ function compileDefaultKeybindings(): ResolvedKeybindingsConfig {
271272
272const DEFAULT_RESOLVED_KEYBINDINGS = compileDefaultKeybindings();273const DEFAULT_RESOLVED_KEYBINDINGS = compileDefaultKeybindings();
273274
274function mergeWithDefaultKeybindings(275function mergeWithDefaultKeybindings(custom: ResolvedKeybindingsConfig): ResolvedKeybindingsConfig {
275 custom: ResolvedKeybindingsConfig,
276): ResolvedKeybindingsConfig {
277 if (custom.length === 0) {276 if (custom.length === 0) {
278 return [...DEFAULT_RESOLVED_KEYBINDINGS];277 return [...DEFAULT_RESOLVED_KEYBINDINGS];
279 }278 }
apps/server/src/wsServer.test.ts+4-8
...@@ -351,7 +351,7 @@ describe("WebSocket Server", () => {...@@ -351,7 +351,7 @@ describe("WebSocket Server", () => {
351 JSON.stringify([351 JSON.stringify([
352 { key: "cmd+j", command: "terminal.toggle" },352 { key: "cmd+j", command: "terminal.toggle" },
353 { key: "mod+d", command: "terminal.split", when: "terminalFocus" },353 { 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" },
355 ]),355 ]),
356 "utf8",356 "utf8",
357 );357 );
...@@ -374,7 +374,7 @@ describe("WebSocket Server", () => {...@@ -374,7 +374,7 @@ describe("WebSocket Server", () => {
374 keybindings: mergeWithDefaultsForTest([374 keybindings: mergeWithDefaultsForTest([
375 { key: "cmd+j", command: "terminal.toggle" },375 { key: "cmd+j", command: "terminal.toggle" },
376 { key: "mod+d", command: "terminal.split", when: "terminalFocus" },376 { 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" },
378 ]),378 ]),
379 });379 });
380 });380 });
...@@ -408,9 +408,7 @@ describe("WebSocket Server", () => {...@@ -408,9 +408,7 @@ describe("WebSocket Server", () => {
408 expect(response.error).toBeUndefined();408 expect(response.error).toBeUndefined();
409 expect(response.result).toEqual({409 expect(response.result).toEqual({
410 cwd: "/my/workspace",410 cwd: "/my/workspace",
411 keybindings: mergeWithDefaultsForTest([411 keybindings: mergeWithDefaultsForTest([{ key: "mod+j", command: "terminal.toggle" }]),
412 { key: "mod+j", command: "terminal.toggle" },
413 ]),
414 });412 });
415 expect(413 expect(
416 warnSpy.mock.calls.some(([message]) =>414 warnSpy.mock.calls.some(([message]) =>
...@@ -479,9 +477,7 @@ describe("WebSocket Server", () => {...@@ -479,9 +477,7 @@ describe("WebSocket Server", () => {
479 expect(firstResponse.error).toBeUndefined();477 expect(firstResponse.error).toBeUndefined();
480 expect(firstResponse.result).toEqual({478 expect(firstResponse.result).toEqual({
481 cwd: "/my/workspace",479 cwd: "/my/workspace",
482 keybindings: mergeWithDefaultsForTest([480 keybindings: mergeWithDefaultsForTest([{ key: "cmd+j", command: "terminal.toggle" }]),
483 { key: "cmd+j", command: "terminal.toggle" },
484 ]),
485 });481 });
486482
487 fs.writeFileSync(483 fs.writeFileSync(