MCPcopy Index your code
hub / github.com/codeaashu/claude-code / validateKeystroke

Function validateKeystroke

src/keybindings/validate.ts:91–125  ·  view source on GitHub ↗

* Validate a single keystroke string and return any parse errors.

(keystroke: string)

Source from the content-addressed store, hash-verified

89 * Validate a single keystroke string and return any parse errors.
90 */
91function validateKeystroke(keystroke: string): KeybindingWarning | null {
92 const parts = keystroke.toLowerCase().split('+')
93
94 for (const part of parts) {
95 const trimmed = part.trim()
96 if (!trimmed) {
97 return {
98 type: 'parse_error',
99 severity: 'error',
100 message: `Empty key part in "${keystroke}"`,
101 key: keystroke,
102 suggestion: 'Remove extra "+" characters',
103 }
104 }
105 }
106
107 // Try to parse and see if it fails
108 const parsed = parseKeystroke(keystroke)
109 if (
110 !parsed.key &&
111 !parsed.ctrl &&
112 !parsed.alt &&
113 !parsed.shift &&
114 !parsed.meta
115 ) {
116 return {
117 type: 'parse_error',
118 severity: 'error',
119 message: `Could not parse keystroke "${keystroke}"`,
120 key: keystroke,
121 }
122 }
123
124 return null
125}
126
127/**
128 * Validate a keybinding block from user config.

Callers 1

validateBlockFunction · 0.85

Calls 1

parseKeystrokeFunction · 0.85

Tested by

no test coverage detected