|
37 | 37 | :type 'boolean |
38 | 38 | :group 'lsp-dart) |
39 | 39 |
|
40 | | -(defcustom lsp-dart-flutter-fringe-color-check-interval 0.5 |
41 | | - "The delay to check when state is idle. |
42 | | -Increase for a better performance." |
43 | | - :type 'float |
44 | | - :group 'lsp-dart) |
45 | | - |
46 | 40 | (when (fboundp 'define-fringe-bitmap) |
47 | 41 | (define-fringe-bitmap 'lsp-dart-flutter-fringe-color-bitmap |
48 | 42 | [255 255 255 255 255 255 255 255 255])) |
@@ -102,25 +96,16 @@ Increase for a better performance." |
102 | 96 | (match-string 3)))) |
103 | 97 | (lsp-dart-flutter-fringe--add-color color buffer (point-at-bol))))))) |
104 | 98 |
|
105 | | -(defvar-local lsp-dart-flutter-fringe-colors-timer nil) |
106 | | - |
107 | | -(defun lsp-dart-flutter-fringe--change-colors-handler (&rest _rest) |
108 | | - "Handler that add/update colors on fringe." |
109 | | - (when lsp-dart-flutter-fringe-colors-timer |
110 | | - (cancel-timer lsp-dart-flutter-fringe-colors-timer)) |
111 | | - (setq lsp-dart-flutter-fringe-colors-timer |
112 | | - (run-with-idle-timer lsp-dart-flutter-fringe-color-check-interval nil #'lsp-dart-flutter-fringe--update-colors (current-buffer)))) |
113 | | - |
114 | 99 | (define-minor-mode lsp-dart-flutter-fringe-colors-mode |
115 | 100 | "Mode for displaying colors in fringe." |
116 | 101 | nil nil nil |
117 | 102 | (cond |
118 | 103 | (lsp-dart-flutter-fringe-colors-mode |
119 | | - (add-hook 'lsp-on-idle-hook #'lsp-dart-flutter-fringe--change-colors-handler nil t)) |
| 104 | + (add-hook 'lsp-on-change-hook (-partial #'lsp-dart-flutter-fringe--update-colors (current-buffer)) nil t)) |
120 | 105 | (t |
121 | 106 | (progn |
122 | 107 | (remove-overlays (point-min) (point-max) 'lsp-dart-flutter-fringe-colors t) |
123 | | - (remove-hook 'lsp-on-idle-hook #'lsp-dart-flutter-fringe--change-colors-handler t))))) |
| 108 | + (remove-hook 'lsp-on-change-hook #'lsp-dart-flutter-fringe--update-colors t))))) |
124 | 109 |
|
125 | 110 | (when lsp-dart-flutter-fringe-colors |
126 | 111 | (add-hook 'lsp-after-open-hook |
|
0 commit comments