mirror of
https://github.com/EthanMarti/infio-copilot.git
synced 2026-05-17 21:41:37 +00:00
29 lines
502 B
TypeScript
29 lines
502 B
TypeScript
// @ts-nocheck
|
|
import { Prec } from "@codemirror/state";
|
|
import { keymap } from "@codemirror/view";
|
|
|
|
function CompletionKeyWatcher(
|
|
handleAcceptKey: () => boolean,
|
|
handlePartialAcceptKey: () => boolean,
|
|
handleCancelKey: () => boolean
|
|
) {
|
|
return Prec.highest(
|
|
keymap.of([
|
|
{
|
|
key: "Tab",
|
|
run: handleAcceptKey,
|
|
},
|
|
{
|
|
key: "ArrowRight",
|
|
run: handlePartialAcceptKey,
|
|
},
|
|
{
|
|
key: "Escape",
|
|
run: handleCancelKey,
|
|
},
|
|
])
|
|
);
|
|
}
|
|
|
|
export default CompletionKeyWatcher;
|