Skip to content

Commit da26904

Browse files
committed
fix: set up the pre-command-hook when starting the completion
Users may use the completion without activating the minor mode (which was originally intended only for idle-completion).
1 parent 5dc9956 commit da26904

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lsp-inline-completion.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ The functions receive the inserted text and the range that was updated by the co
171171
(when (overlayp lsp-inline-completion--overlay)
172172
(delete-overlay lsp-inline-completion--overlay))
173173
(setq lsp-inline-completion--overlay nil)
174-
(internal-pop-keymap lsp-inline-completion-active-map 'overriding-terminal-local-map))
174+
(internal-pop-keymap lsp-inline-completion-active-map 'overriding-terminal-local-map)
175+
(remove-hook 'pre-command-hook #'lsp-inline-completion--pre-command-hook t))
175176

176177

177178
(defun lsp-inline-completion--show-keys ()
@@ -206,6 +207,7 @@ The functions receive the inserted text and the range that was updated by the co
206207
"Build the suggestions overlay."
207208
(lsp-inline-completion--clear-overlay)
208209

210+
(add-hook 'pre-command-hook #'lsp-inline-completion--pre-command-hook nil t)
209211
(setq lsp-inline-completion--overlay (make-overlay beg end nil nil t))
210212
(overlay-put lsp-inline-completion--overlay 'priority lsp-inline-completion-overlay-priority)
211213
(internal-push-keymap lsp-inline-completion-active-map 'overriding-terminal-local-map)
@@ -433,7 +435,6 @@ lsp-inline-completion-mode is active."
433435
:lighter nil
434436
(cond
435437
((and lsp-inline-completion-mode lsp--buffer-workspaces)
436-
(add-hook 'pre-command-hook #'lsp-inline-completion--pre-command-hook nil t)
437438
(add-hook 'lsp-on-change-hook #'lsp-inline-completion--after-change nil t))
438439

439440
(t
@@ -442,7 +443,6 @@ lsp-inline-completion-mode is active."
442443

443444
(lsp-inline-completion-cancel)
444445

445-
(remove-hook 'pre-command-hook #'lsp-inline-completion--pre-command-hook t)
446446
(remove-hook 'lsp-on-change-hook #'lsp-inline-completion--after-change t))))
447447

448448
(defun lsp-inline-completion--maybe-display (original-buffer original-point)

0 commit comments

Comments
 (0)