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