Skip to content

Commit 9a08059

Browse files
committed
`lsp-ui-sideline': disabled code actions optional
The new `defcustom' `lsp-ui-sideline-show-disabled-code-actions' controls whether disabled code actions should be shown at all.
1 parent 9e6f6ce commit 9a08059

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lsp-ui-sideline.el

+11-3
Original file line numberDiff line numberDiff line change
@@ -470,13 +470,21 @@ Push sideline overlays on `lsp-ui-sideline--ovs'."
470470
'((t :inherit lsp-disabled-code-action-face))
471471
"Faced used to show disabled code actions in the sideline.")
472472

473+
(defcustom lsp-ui-sideline-show-disabled-code-actions t
474+
"Whether disabled code actions should be shown.
475+
They cannot be executed."
476+
:type 'boolean
477+
:group 'lsp-ui-sideline)
478+
473479
(defun lsp-ui-sideline--code-actions (actions bol eol)
474480
"Show code ACTIONS."
475481
(let ((inhibit-modification-hooks t))
476482
(when lsp-ui-sideline-actions-kind-regex
477-
(setq actions (seq-filter (-lambda ((&CodeAction :kind?))
478-
(or (not kind?)
479-
(s-match lsp-ui-sideline-actions-kind-regex kind?)))
483+
(setq actions (seq-filter (-lambda ((&CodeAction :kind? :disabled?))
484+
(and (or (not disabled?)
485+
lsp-ui-sideline-show-disabled-code-actions)
486+
(or (not kind?)
487+
(s-match lsp-ui-sideline-actions-kind-regex kind?))))
480488
actions)))
481489
(setq lsp-ui-sideline--code-actions actions)
482490
(lsp-ui-sideline--delete-kind 'actions)

0 commit comments

Comments
 (0)