mirror of
https://github.com/EthanMarti/infio-copilot.git
synced 2026-06-09 22:44:46 +00:00
init
This commit is contained in:
27
src/render-plugin/completion-key-watcher.ts
Normal file
27
src/render-plugin/completion-key-watcher.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user