Skip to content

feat(keymap): defer keymaps to completion menu#334

Open
sudo-tee wants to merge 1 commit intomainfrom
feat/completion-defer-per-keymap
Open

feat(keymap): defer keymaps to completion menu#334
sudo-tee wants to merge 1 commit intomainfrom
feat/completion-defer-per-keymap

Conversation

@sudo-tee
Copy link
Owner

Add support for deferring keymap actions to the completion engine when the completion menu is visible. Introduces defer_to_completion field for keymap entries, wraps callbacks to feed the original key sequence to the completion module when visible, updates defaults and README, and adds unit tests and types for the new behavior.

This should fix #332

Add support for deferring keymap actions to the completion engine when
the completion menu is visible. Introduces defer_to_completion field
for keymap entries, wraps callbacks to feed the original key sequence
to the completion module when visible, updates defaults and README,
and adds unit tests and types for the new behavior.

This should fix #332
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds per-keymap control to defer key handling to the active completion UI when the completion menu is visible, addressing intermittent input-window insert-mode keybind issues (Fixes #332).

Changes:

  • Introduces defer_to_completion on keymap entries and updates keymap processing to wrap only those bindings.
  • Updates default input-window keymaps to defer only the bindings that should yield to completion navigation.
  • Updates docs/types and adds unit tests covering the new deferral behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lua/opencode/keymap.lua Implements per-entry completion deferral by wrapping callbacks when defer_to_completion is set.
lua/opencode/ui/input_window.lua Stops globally deferring all input-window keymaps; relies on per-entry deferral instead.
lua/opencode/config.lua Updates default input-window keymaps to mark specific bindings as defer_to_completion = true.
lua/opencode/types.lua Documents the new defer_to_completion field in the keymap entry type.
tests/unit/keymap_spec.lua Adds unit tests verifying direct-callback vs feedkeys behavior when completion is visible.
README.md Documents defer_to_completion and updates example config; adjusts fenced code blocks (currently broken).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -1,9 +1,12 @@
local config = require('opencode.config')
<selected text>
```
```
````
Comment on lines +670 to +672
````

````
:Opencode run new_session "Please help me plan a new feature" agent=plan context.current_file.enabled=false
:Opencode run "Fix the bug in the current file" model=github-copilot/claude-sonnet-4
```
````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Input window insert-mode keybinds intermittently don't fire

2 participants