File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,9 @@ ANCHOR is the anchor point of the widget guide at LINE."
125125 (let ((char start-char))
126126 (while (<= char end-char)
127127 (if (= char start-char)
128- (setf (nth char chars) lsp-dart-flutter-widget-guide-bottom-corner)
128+ (if (nth char chars)
129+ (setf (nth char chars) lsp-dart-flutter-widget-guide-bottom-corner)
130+ (setq chars (append chars (list lsp-dart-flutter-widget-guide-bottom-corner))))
129131 (if (nth char chars)
130132 (setf (nth char chars) lsp-dart-flutter-widget-guide-horizontal-line)
131133 (setq chars (append chars (list lsp-dart-flutter-widget-guide-horizontal-line)))))
@@ -156,5 +158,20 @@ ANCHOR is the anchor point of the widget guide at LINE."
156158 (--each-indexed chars (lsp-dart-flutter-widget-guide--add-overlay-to buffer line (+ it-index anchor) it))))
157159 guides-by-line)))))
158160
161+ (define-minor-mode lsp-dart-flutter-widget-guides-mode
162+ " Mode for displaying flutter widget guide lines."
163+ nil nil nil
164+ (cond
165+ (lsp-dart-flutter-widget-guides-mode
166+ (add-hook 'lsp-dart-outline-arrived-hook #'lsp-dart-flutter-widget-guide-check nil t ))
167+ (t
168+ (progn
169+ (remove-overlays (point-min ) (point-max ) 'category 'lsp-dart-flutter-widget-guide )
170+ (remove-hook 'lsp-dart-outline-arrived-hook #'lsp-dart-flutter-widget-guide-check t )))))
171+
172+ (add-hook 'lsp-before-open-hook (lambda ()
173+ (when lsp-dart-flutter-widget-guides
174+ (lsp-dart-flutter-widget-guides-mode 1 ))))
175+
159176(provide 'lsp-dart-flutter-widget-guide )
160177; ;; lsp-dart-flutter-widget-guide.el ends here
Original file line number Diff line number Diff line change 2424(require 'lsp-dart-protocol )
2525(require 'lsp-dart-utils )
2626(require 'lsp-dart-code-lens )
27- (require 'lsp-dart-flutter-widget-guide )
2827
2928(defcustom lsp-dart-outline t
3029 " Enable the analysis server outline custom method.
@@ -225,8 +224,7 @@ It updates the outline view if it already exists."
225224NOTIFICATION is Flutter outline notification data received from server.
226225It updates the Flutter outline view if it already exists."
227226 (lsp-dart-outline--set-metadata workspace notification " current-flutter-outline" )
228- (when lsp-dart-flutter-widget-guides
229- (lsp-dart-flutter-widget-guide-check notification))
227+ (run-hook-with-args 'lsp-dart-outline-arrived-hook notification)
230228 (when (get-buffer-window " *Flutter Outline*" )
231229 (lsp-dart-outline--show-flutter-outline (find-buffer-visiting (lsp--uri-to-path uri)) t )))
232230
Original file line number Diff line number Diff line change 3434(require 'lsp-dart-closing-labels )
3535(require 'lsp-dart-outline )
3636(require 'lsp-dart-flutter-fringe )
37+ (require 'lsp-dart-flutter-widget-guide )
3738
3839(defgroup lsp-dart nil
3940 " LSP support for Dart, using dart analysis server."
You can’t perform that action at this time.
0 commit comments