@@ -322,6 +322,9 @@ CURRENT is non-nil when the point is on the symbol."
322322 (overlay-put ov 'after-string string)
323323 (push ov lsp-ui-sideline--ovs))))))
324324
325+ (defun lsp-ui-sideline--code-action-title (action )
326+ (replace-regexp-in-string " [\n\t ]+" " " (gethash " title" action)))
327+
325328(defvar-local lsp-ui-sideline--code-actions nil )
326329
327330(defun lsp-ui-sideline-apply-code-actions nil
@@ -330,9 +333,9 @@ CURRENT is non-nil when the point is on the symbol."
330333 (unless lsp-ui-sideline--code-actions
331334 (user-error " No code actions on the current line" ))
332335 (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)
334337 nil t ))
335- (action (--first (equal (gethash " title" it) title) actions)))
338+ (action (--first (equal (lsp-ui-sideline--code-action- title it) title) actions)))
336339 (unless action
337340 (error " Fail to apply action " ))
338341 (lsp-execute-code-action action)))
@@ -341,8 +344,7 @@ CURRENT is non-nil when the point is on the symbol."
341344 " Show code ACTIONS."
342345 (setq lsp-ui-sideline--code-actions actions)
343346 (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)
346348 (concat lsp-ui-sideline-code-actions-prefix)))
347349 (margin (lsp-ui-sideline--margin-width))
348350 (keymap (let ((map (make-sparse-keymap )))
0 commit comments