28
28
29
29
; ;; Code:
30
30
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 )
61
32
62
33
(defun lsp-inline-completion--params (implicit &optional identifier position )
63
34
" Returns a InlineCompletionParams instance"
@@ -91,7 +62,6 @@ InlineCompletionItem objects"
91
62
92
63
; ;;;;; Default UI -- overlay
93
64
94
- ;;;### autoload
95
65
(defvar lsp-inline-completion-active-map
96
66
(let ((map (make-sparse-keymap )))
97
67
; ; accept
@@ -115,7 +85,6 @@ InlineCompletionItem objects"
115
85
map)
116
86
" Keymap active when showing inline code suggestions" )
117
87
118
- ;;;### autoload
119
88
(defface lsp-inline-completion-overlay-face
120
89
'((t :inherit shadow ))
121
90
" Face for the inline code suggestions overlay."
@@ -334,7 +303,7 @@ text range that was updated by the completion"
334
303
335
304
(with-no-warnings
336
305
; ; Compiler does not believes this macro is defined
337
- (lsp-inline-completion-- with-undo-amalgamate
306
+ (lsp-with-undo-amalgamate
338
307
(lsp-inline-completion--insert-sugestion text kind start end command?) ))))
339
308
340
309
(defun lsp-inline-completion-accept-on-click (event )
@@ -422,6 +391,7 @@ text range that was updated by the completion"
422
391
423
392
424
393
; ; Inline Completion Mode
394
+ ;;;### autoload
425
395
(defcustom lsp-inline-completion-enable t
426
396
" If non-nil it will enable inline completions on idle."
427
397
:type 'boolean
0 commit comments