Skip to content

Commit 9b8828c

Browse files
committed
Change hook for flutter fringe color update
1 parent e13d4e6 commit 9b8828c

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ You can also open the [Dart DevTools](https://dart.dev/tools/dart-devtools) on t
101101
* `lsp-dart-flutter-outline` - Enable the Flutter outline tree view feature on server lsp.
102102
* `lsp-dart-flutter-outline-position-params` - The Flutter outline tree position params. Defaults to side.
103103
* `lsp-dart-flutter-fringe-colors` - Enable the Flutter colors on fringe. Defaults to t.
104-
* `lsp-dart-flutter-fringe-color-check-interval` - The interval to check for a color change when in idle state. Defaults to `0.5`.
105104
* `lsp-dart-flutter-widget-guides` - Enable the Flutter widget guide lines from parent to child widgets. Defaults to t.
106105
* `lsp-dart-test-code-lens` - Enable the `Run` code lens on tests. Defaults to t.
107106
* `lsp-dart-dap-extension-version` - The debugger extension version. Defaults to [3.9.1](https://github.com/Dart-Code/Dart-Code/releases/tag/v3.9.1)

lsp-dart-flutter-fringe.el

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@
3737
:type 'boolean
3838
:group 'lsp-dart)
3939

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-
4640
(when (fboundp 'define-fringe-bitmap)
4741
(define-fringe-bitmap 'lsp-dart-flutter-fringe-color-bitmap
4842
[255 255 255 255 255 255 255 255 255]))
@@ -102,25 +96,16 @@ Increase for a better performance."
10296
(match-string 3))))
10397
(lsp-dart-flutter-fringe--add-color color buffer (point-at-bol)))))))
10498

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-
11499
(define-minor-mode lsp-dart-flutter-fringe-colors-mode
115100
"Mode for displaying colors in fringe."
116101
nil nil nil
117102
(cond
118103
(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))
120105
(t
121106
(progn
122107
(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)))))
124109

125110
(when lsp-dart-flutter-fringe-colors
126111
(add-hook 'lsp-after-open-hook

0 commit comments

Comments
 (0)