Skip to content

Commit 9e6f6ce

Browse files
committed
`lsp-ui-sideline': highlight disabled code actions
1 parent 72034bd commit 9e6f6ce

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lsp-ui-sideline.el

+8
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,10 @@ Push sideline overlays on `lsp-ui-sideline--ovs'."
466466
(propertize " " 'display (lsp-ui-sideline--code-actions-make-image))
467467
(propertize " " 'display '(space :width 0.3))))))
468468

469+
(defface lsp-ui-sideline-disabled-code-action-face
470+
'((t :inherit lsp-disabled-code-action-face))
471+
"Faced used to show disabled code actions in the sideline.")
472+
469473
(defun lsp-ui-sideline--code-actions (actions bol eol)
470474
"Show code ACTIONS."
471475
(let ((inhibit-modification-hooks t))
@@ -489,8 +493,12 @@ Push sideline overlays on `lsp-ui-sideline--ovs'."
489493
(lsp-execute-code-action action))))
490494
map))
491495
(len (length title))
496+
(disabled? (lsp:code-action-disabled? action))
492497
(title (progn (add-face-text-property 0 len 'lsp-ui-sideline-global nil title)
493498
(add-face-text-property 0 len 'lsp-ui-sideline-code-action nil title)
499+
(when disabled?
500+
(add-face-text-property 0 len 'lsp-ui-sideline-disabled-code-action-face nil title)
501+
(add-text-properties 0 len `(help-echo ,(lsp:code-action-disabled-reason disabled?)) title))
494502
(add-text-properties 0 len `(keymap ,keymap mouse-face highlight) title)
495503
title))
496504
(string (concat (propertize " " 'display `(space :align-to (- right-fringe ,(lsp-ui-sideline--align (+ len (length image)) margin))))

0 commit comments

Comments
 (0)