@@ -332,6 +332,9 @@ CURRENT is non-nil when the point is on the symbol."
332
332
(overlay-put ov 'after-string string)
333
333
(push ov lsp-ui-sideline--ovs))))))
334
334
335
+ (defun lsp-ui-sideline--code-action-title (action )
336
+ (replace-regexp-in-string " [\n\t ]+" " " (gethash " title" action)))
337
+
335
338
(defvar-local lsp-ui-sideline--code-actions nil )
336
339
337
340
(defun lsp-ui-sideline-apply-code-actions nil
@@ -340,9 +343,9 @@ CURRENT is non-nil when the point is on the symbol."
340
343
(unless lsp-ui-sideline--code-actions
341
344
(user-error " No code actions on the current line" ))
342
345
(let* ((actions lsp-ui-sideline--code-actions)
343
- (title (completing-read " Apply: " (-- map ( gethash " title" it) actions)
346
+ (title (completing-read " Apply: " (-map # 'lsp-ui-sideline--code-action- title actions)
344
347
nil t ))
345
- (action (--first (equal (gethash " title" it) title) actions)))
348
+ (action (--first (equal (lsp-ui-sideline--code-action- title it) title) actions)))
346
349
(unless action
347
350
(error " Fail to apply action " ))
348
351
(lsp-execute-code-action action)))
@@ -351,8 +354,7 @@ CURRENT is non-nil when the point is on the symbol."
351
354
" Show code ACTIONS."
352
355
(setq lsp-ui-sideline--code-actions actions)
353
356
(dolist (action actions)
354
- (-let* ((title (->> (gethash " title" action)
355
- (replace-regexp-in-string " [\n\t ]+" " " )
357
+ (-let* ((title (->> (lsp-ui-sideline--code-action-title action)
356
358
(concat lsp-ui-sideline-code-actions-prefix)))
357
359
(margin (lsp-ui-sideline--margin-width))
358
360
(keymap (let ((map (make-sparse-keymap )))
0 commit comments