Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Copilot panel #4678

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Draft: Copilot panel #4678

wants to merge 8 commits into from

Conversation

kassick
Copy link
Contributor

@kassick kassick commented Jan 8, 2025

Regarding #4661

Still WIP. Built on top of #4676

@github-actions github-actions bot added the client One or more of lsp-mode language clients label Jan 8, 2025
When some other overlay is active at point with a keymap property, even when
its priority is lower than the inline completion priority, this foreign keymap
may override the inline completion keymap.

This happens, for example, when the inline completion is shown inside a pair
inserted by smartparens. For example, the user types `[` followed `<return>`
-- smartparens will insert the closing pair. The result is the buffer with the
following state (cursor at `|`:

```
list = [
    |
]
```

Smartparens will have placed an overlay from `[` to up `]`. This overlay has a
keymap property mapping `C-g` to a function that removes the overlay.

When inline completion is shown (either on idle or by user request), the
keymap from smartparens overlay is active despite the inline completion
overlay's higher priority.

As a result, pressing `C-<return>` will likely display a message complaining
the key is not bound.

If the user presses `C-g` once, then they gain access to the inline completion
keymap.

This caused a weird bug in which a user gets a suggestion, but can't accept
it. Pressing C-g only once would not cancel the completion, but pressing it
again would indeed high the completion overlay. Explicitly asking for a
suggestion at the same point would then display the completion overlay and the
keymap would work as expected, since the first C-g removed the smartparens
overlay.

This commit fixes the issue by using a transient map when displaying the
overlay. The transient map will take priority over any active overlay map, so
we do not run into this issue from smartparens or any other mode that may be
placing overlays with active keymaps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client One or more of lsp-mode language clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant