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
328328 Effect.map((resolved) => resolved),
329329 ),
330330
331− encode: (resolved) =>
332− Effect.gen(function* () {
333− const key = encodeShortcut(resolved.shortcut);
334− if (!key) {
335− return yield* Effect.fail(
336− new SchemaIssue.InvalidValue(Option.some(resolved), {
337− title: "Resolved shortcut cannot be encoded to key string",
338− }),
339− );
340− }
331+ encode: Effect.fn("ResolvedKeybindingFromConfig.encode")(function* (resolved) {
332+ const key = encodeShortcut(resolved.shortcut);
333+ if (!key) {
334+ return yield* Effect.fail(
335+ new SchemaIssue.InvalidValue(Option.some(resolved), {
336+ title: "Resolved shortcut cannot be encoded to key string",
337+ }),
338+ );
339+ }
341340
342− const when = resolved.whenAst ? encodeWhenAst(resolved.whenAst) : undefined;
343− return {
344− key,
345− command: resolved.command,
346− when,
347− };
348− }),
341+ const when = resolved.whenAst ? encodeWhenAst(resolved.whenAst) : undefined;
342+ return {
343+ key,
344+ command: resolved.command,
345+ when,
346+ };
347+ }),
349348 }),
350349 ),
351350 );
@@ -581,8 +580,9 @@ const makeKeybindings = Effect.gen(function* () { · 229 unmodified lines
581580 ),
582581 );
583582
584− return yield* Effect.forEach(rawConfig, (entry) =>
585− Effect.gen(function* () {
583+ return yield* Effect.forEach(
584+ rawConfig,
585+ Effect.fn("loadWritableCustomKeybindingsConfig.decodeEntry")(function* (entry) {
586586 const decodedRule = Schema.decodeUnknownExit(KeybindingRule)(entry);
587587 if (decodedRule._tag === "Failure") {
588588 yield* Effect.logWarning("ignoring invalid keybinding entry", {