@@ -332,6 +332,9 @@ CURRENT is non-nil when the point is on the symbol."
332332 (overlay-put ov 'after-string string)
333333 (push ov lsp-ui-sideline--ovs))))))
334334
335+ (defun lsp-ui-sideline--code-action-title (action )
336+ (replace-regexp-in-string " [\n\t ]+" " " (gethash " title" action)))
337+
335338(defvar-local lsp-ui-sideline--code-actions nil )
336339
337340(defun lsp-ui-sideline-apply-code-actions nil
@@ -340,9 +343,9 @@ CURRENT is non-nil when the point is on the symbol."
340343 (unless lsp-ui-sideline--code-actions
341344 (user-error " No code actions on the current line" ))
342345 (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)
344347 nil t ))
345- (action (--first (equal (gethash " title" it) title) actions)))
348+ (action (--first (equal (lsp-ui-sideline--code-action- title it) title) actions)))
346349 (unless action
347350 (error " Fail to apply action " ))
348351 (lsp-execute-code-action action)))
@@ -351,8 +354,7 @@ CURRENT is non-nil when the point is on the symbol."
351354 " Show code ACTIONS."
352355 (setq lsp-ui-sideline--code-actions actions)
353356 (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)
356358 (concat lsp-ui-sideline-code-actions-prefix)))
357359 (margin (lsp-ui-sideline--margin-width))
358360 (keymap (let ((map (make-sparse-keymap )))
0 commit comments