@@ -170,6 +170,10 @@ function encodeWhenAst(node: KeybindingWhenNode): string {
170170
171171const RawKeybindingsEntries = fromLenientJson ( Schema . Array ( Schema . Unknown ) ) ;
172172const KeybindingsConfigPrettyJson = fromJsonStringPretty ( KeybindingsConfig ) ;
173+ const decodeKeybindingRuleExit = Schema . decodeUnknownExit ( KeybindingRule ) ;
174+ const decodeResolvedKeybindingFromConfigExit = Schema . decodeExit ( ResolvedKeybindingFromConfig ) ;
175+ const decodeRawKeybindingsEntriesExit = Schema . decodeUnknownExit ( RawKeybindingsEntries ) ;
176+ const encodeKeybindingsConfigPrettyJson = Schema . encodeEffect ( KeybindingsConfigPrettyJson ) ;
173177
174178export interface KeybindingsConfigState {
175179 readonly keybindings : ResolvedKeybindingsConfig ;
@@ -344,7 +348,7 @@ const makeKeybindings = Effect.gen(function* () {
344348
345349 return yield * Effect . forEach ( rawConfig , ( entry ) =>
346350 Effect . gen ( function * ( ) {
347- const decodedRule = Schema . decodeUnknownExit ( KeybindingRule ) ( entry ) ;
351+ const decodedRule = decodeKeybindingRuleExit ( entry ) ;
348352 if ( decodedRule . _tag === "Failure" ) {
349353 yield * Effect . logWarning ( "ignoring invalid keybinding entry" , {
350354 path : keybindingsConfigPath ,
@@ -353,7 +357,7 @@ const makeKeybindings = Effect.gen(function* () {
353357 } ) ;
354358 return null ;
355359 }
356- const resolved = Schema . decodeExit ( ResolvedKeybindingFromConfig ) ( decodedRule . value ) ;
360+ const resolved = decodeResolvedKeybindingFromConfigExit ( decodedRule . value ) ;
357361 if ( resolved . _tag === "Failure" ) {
358362 yield * Effect . logWarning ( "ignoring invalid keybinding entry" , {
359363 path : keybindingsConfigPath ,
@@ -379,7 +383,7 @@ const makeKeybindings = Effect.gen(function* () {
379383 }
380384
381385 const rawConfig = yield * readRawConfig ;
382- const decodedEntries = Schema . decodeUnknownExit ( RawKeybindingsEntries ) ( rawConfig ) ;
386+ const decodedEntries = decodeRawKeybindingsEntriesExit ( rawConfig ) ;
383387 if ( decodedEntries . _tag === "Failure" ) {
384388 const detail = `expected JSON array (${ Cause . pretty ( decodedEntries . cause ) } )` ;
385389 return {
@@ -391,7 +395,7 @@ const makeKeybindings = Effect.gen(function* () {
391395 const keybindings : KeybindingRule [ ] = [ ] ;
392396 const issues : ServerConfigIssue [ ] = [ ] ;
393397 for ( const [ index , entry ] of decodedEntries . value . entries ( ) ) {
394- const decodedRule = Schema . decodeUnknownExit ( KeybindingRule ) ( entry ) ;
398+ const decodedRule = decodeKeybindingRuleExit ( entry ) ;
395399 if ( decodedRule . _tag === "Failure" ) {
396400 const detail = Cause . pretty ( decodedRule . cause ) ;
397401 issues . push ( invalidEntryIssue ( index , detail ) ) ;
@@ -404,7 +408,7 @@ const makeKeybindings = Effect.gen(function* () {
404408 continue ;
405409 }
406410
407- const resolvedRule = Schema . decodeExit ( ResolvedKeybindingFromConfig ) ( decodedRule . value ) ;
411+ const resolvedRule = decodeResolvedKeybindingFromConfigExit ( decodedRule . value ) ;
408412 if ( resolvedRule . _tag === "Failure" ) {
409413 const detail = Cause . pretty ( resolvedRule . cause ) ;
410414 issues . push ( invalidEntryIssue ( index , detail ) ) ;
@@ -423,7 +427,7 @@ const makeKeybindings = Effect.gen(function* () {
423427 } ) ;
424428
425429 const writeConfigAtomically = ( rules : readonly KeybindingRule [ ] ) => {
426- return Schema . encodeEffect ( KeybindingsConfigPrettyJson ) ( rules ) . pipe (
430+ return encodeKeybindingsConfigPrettyJson ( rules ) . pipe (
427431 Effect . map ( ( encoded ) => `${ encoded } \n` ) ,
428432 Effect . flatMap ( ( encoded ) =>
429433 writeFileStringAtomically ( {
0 commit comments