|
32 | 32 | :type 'boolean
|
33 | 33 | :group 'lsp-icons)
|
34 | 34 |
|
35 |
| -(declare-function all-the-icons-material "ext:all-the-icons" t t) |
| 35 | +(defcustom lsp-modeline-code-action-icons-enable t |
| 36 | + "If non-nil, icons support is enabled for modeline-code-action" |
| 37 | + :type 'boolean |
| 38 | + :group 'lsp-icons) |
| 39 | + |
36 | 40 | (declare-function lsp-treemacs-symbol-icon "ext:lsp-treemacs" (kind))
|
37 | 41 | (declare-function lsp-treemacs-get-icon "ext:lsp-treemacs" (icon-name))
|
38 | 42 |
|
39 | 43 | (defun lsp-icons--enabled-for-feature (feature)
|
40 | 44 | "Check if icons support is enabled for FEATURE."
|
41 | 45 | (cond
|
42 | 46 | ((eq feature 'headerline-breadcrumb) lsp-headerline-breadcrumb-icons-enable)
|
| 47 | + ((eq feature 'modeline-code-action) lsp-modeline-code-action-icons-enable) |
43 | 48 | (t t)))
|
44 | 49 |
|
45 | 50 | (defun lsp-icons--fix-image-background (image)
|
@@ -79,16 +84,17 @@ if its enabled."
|
79 | 84 | (lsp-icons--fix-image-background
|
80 | 85 | (lsp-treemacs-symbol-icon kind))))
|
81 | 86 |
|
82 |
| -(defun lsp-icons-all-the-icons-material-icon (icon-name face fallback &optional feature) |
83 |
| - "Get a material icon from all-the-icons by ICON-NAME using FACE. |
| 87 | +(defun lsp-icons-all-the-icons-icon (icon-set icon-name face fallback &optional feature &rest args) |
| 88 | + "Get icon ICON-NAME from `all-the-icons' ICON-SET using FACE. |
| 89 | +If ARGS is provided, it's a plist passed directly to the `all-the-icons' function. |
84 | 90 | Fallback to FALLBACK string if not found or not available.
|
85 | 91 | FEATURE is the feature that will use the icon which we should check
|
86 | 92 | if its enabled."
|
87 |
| - (if (and (functionp 'all-the-icons-material) |
88 |
| - (lsp-icons--enabled-for-feature feature)) |
89 |
| - (all-the-icons-material icon-name |
90 |
| - :face face) |
91 |
| - (propertize fallback 'face face))) |
| 93 | + (let ((icon-set-fn (intern-soft (concat "all-the-icons-" (symbol-name icon-set))))) |
| 94 | + (if (and (fboundp icon-set-fn) |
| 95 | + (lsp-icons--enabled-for-feature feature)) |
| 96 | + (apply icon-set-fn icon-name :face face args) |
| 97 | + (propertize fallback 'face face)))) |
92 | 98 |
|
93 | 99 | (lsp-consistency-check lsp-icons)
|
94 | 100 |
|
|
0 commit comments