Skip to content

fix: cancel inline completion UI on non mapped commands #4843

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

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

Conversation

kassick
Copy link
Contributor

@kassick kassick commented Jul 23, 2025

On some situations, keybindings such as M-x are not caught by the default handler (lsp-inline-completion-cancel-with-input, via overriding-terminal-local-map). This results in the tooltip not being hidden when it should. The consequence is that the user has to explicitly call lsp-inline-completion-cancel to hide the completion overlay and continue working in the buffer

This change fixes that by placing a symbol property on the commands that should not cancel the UI (accept, next, prev, recenter-top-botton and ignore). On pre-command hook, we check for that property and cancel the completion if needed.

@kassick kassick force-pushed the fix/cancel-inline-completion-on-command branch 3 times, most recently from a7ad0e2 to a7a5f51 Compare July 23, 2025 03:03
@kassick
Copy link
Contributor Author

kassick commented Jul 23, 2025

(Done with pushing, should be good to review by now ;) )

@kassick kassick force-pushed the fix/cancel-inline-completion-on-command branch from a74b02f to b2637b7 Compare August 8, 2025 19:10
On some situations, keybindings such as M-x are not caught by the default
handler (lsp-inline-completion-cancel-with-input, via
overriding-terminal-local-map). This results in the tooltip not being hidden
when it should. The consequence is that the user has to explicitly call
lsp-inline-completion-cancel to hide the completion overlay and continue
working in the buffer

This change fixes that by placing a symbol property on the commands that
should not cancel the UI (accept, next, prev, recenter-top-botton and ignore).
On pre-command hook, we check for that property and cancel the completion if
needed.
With the lsp-inline-completion--keep method, we no longer need the cancel with
input method -- simply let the binding on some other keymap be found and
cancel the completion in the pre-command-hook
Users may use the completion without activating the minor mode (which was
originally intended only for idle-completion).
@kassick kassick force-pushed the fix/cancel-inline-completion-on-command branch from b2637b7 to da26904 Compare August 11, 2025 17:36
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.

1 participant