2828
2929; ;; Code:
3030
31- (require 'lsp-protocol )
32- (require 'dash )
33- (require 'cl-lib )
34- (require 'fringe )
35-
36- (if (version< emacs-version " 29.1" )
37- ; ; Undo macro probably introduced in 29.1
38- (defmacro lsp-inline-completion--with-undo-amalgamate (&rest body )
39- " Like `progn' but perform BODY with amalgamated undo barriers.
40-
41- This allows multiple operations to be undone in a single step.
42- When undo is disabled this behaves like `progn' ."
43- (declare (indent 0 ) (debug t ))
44- (let ((handle (make-symbol " --change-group-handle--" )))
45- `(let ((, handle (prepare-change-group ))
46- ; ; Don't truncate any undo data in the middle of this,
47- ; ; otherwise Emacs might truncate part of the resulting
48- ; ; undo step: we want to mimic the behavior we'd get if the
49- ; ; undo-boundaries were never added in the first place.
50- (undo-outer-limit nil )
51- (undo-limit most-positive-fixnum)
52- (undo-strong-limit most-positive-fixnum))
53- (unwind-protect
54- (progn
55- (activate-change-group , handle )
56- ,@body )
57- (progn
58- (accept-change-group , handle )
59- (undo-amalgamate-change-group , handle ))))))
60- (defalias 'lsp-inline-completion--with-undo-amalgamate 'with-undo-amalgamate ))
31+ (require 'lsp-mode )
6132
6233(defun lsp-inline-completion--params (implicit &optional identifier position )
6334 " Returns a InlineCompletionParams instance"
@@ -91,7 +62,6 @@ InlineCompletionItem objects"
9162
9263; ;;;;; Default UI -- overlay
9364
94- ;;;### autoload
9565(defvar lsp-inline-completion-active-map
9666 (let ((map (make-sparse-keymap )))
9767 ; ; accept
@@ -115,7 +85,6 @@ InlineCompletionItem objects"
11585 map)
11686 " Keymap active when showing inline code suggestions" )
11787
118- ;;;### autoload
11988(defface lsp-inline-completion-overlay-face
12089 '((t :inherit shadow ))
12190 " Face for the inline code suggestions overlay."
@@ -334,7 +303,7 @@ text range that was updated by the completion"
334303
335304 (with-no-warnings
336305 ; ; Compiler does not believes this macro is defined
337- (lsp-inline-completion-- with-undo-amalgamate
306+ (lsp-with-undo-amalgamate
338307 (lsp-inline-completion--insert-sugestion text kind start end command?) ))))
339308
340309(defun lsp-inline-completion-accept-on-click (event )
@@ -422,6 +391,7 @@ text range that was updated by the completion"
422391
423392
424393; ; Inline Completion Mode
394+ ;;;### autoload
425395(defcustom lsp-inline-completion-enable t
426396 " If non-nil it will enable inline completions on idle."
427397 :type 'boolean
0 commit comments