History

migrate Effect.fn in apps/server/src/keybindings.ts

Julius Marminge committed 7 months ago

Commit 8ce265e1 parent d8aa2f81 file · +19 −19Browse files

Unified · Split

apps/server/src/keybindings.ts+19−19
@@ -328,24 +328,23 @@ export const ResolvedKeybindingFromConfig = KeybindingRule.pipe( · 327 unmodified lines
328 Effect.map((resolved) => resolved),328 Effect.map((resolved) => resolved),
329 ),329 ),
330 330
331 encode: (resolved) =>331 encode: Effect.fn("ResolvedKeybindingFromConfig.encode")(function* (resolved) {
332 Effect.gen(function* () {332 const key = encodeShortcut(resolved.shortcut);
333 const key = encodeShortcut(resolved.shortcut);333 if (!key) {
334 if (!key) {334 return yield* Effect.fail(
335 return yield* Effect.fail(335 new SchemaIssue.InvalidValue(Option.some(resolved), {
336 new SchemaIssue.InvalidValue(Option.some(resolved), {336 title: "Resolved shortcut cannot be encoded to key string",
337 title: "Resolved shortcut cannot be encoded to key string",337 }),
338 }),338 );
339 );339 }
340 }
341 340
342 const when = resolved.whenAst ? encodeWhenAst(resolved.whenAst) : undefined;341 const when = resolved.whenAst ? encodeWhenAst(resolved.whenAst) : undefined;
343 return {342 return {
344 key,343 key,
345 command: resolved.command,344 command: resolved.command,
346 when,345 when,
347 };346 };
348 }),347 }),
349 }),348 }),
350 ),349 ),
351);350);
@@ -581,8 +580,9 @@ const makeKeybindings = Effect.gen(function* () { · 229 unmodified lines
581 ),580 ),
582 );581 );
583 582
584 return yield* Effect.forEach(rawConfig, (entry) =>583 return yield* Effect.forEach(
585 Effect.gen(function* () {584 rawConfig,
585 Effect.fn("loadWritableCustomKeybindingsConfig.decodeEntry")(function* (entry) {
586 const decodedRule = Schema.decodeUnknownExit(KeybindingRule)(entry);586 const decodedRule = Schema.decodeUnknownExit(KeybindingRule)(entry);
587 if (decodedRule._tag === "Failure") {587 if (decodedRule._tag === "Failure") {
588 yield* Effect.logWarning("ignoring invalid keybinding entry", {588 yield* Effect.logWarning("ignoring invalid keybinding entry", {