Skip to content

Commit

Permalink
Make auto jump to exceptions configurable from the menu
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmonettas committed Nov 29, 2024
1 parent 25b059f commit 571f3e5
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## master (unreleased)

### New Features

- Add configurable auto jump to exceptions

### Changes

Expand Down
3 changes: 3 additions & 0 deletions docs/user_guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,9 @@ together with the exceptions types. If you hover the mouse over any of them, a t

Clicking on any of them will position the stepper at that point in time so you can explore what happened before.

You can configure FlowStorm to automatically jump to exceptions with the `Config` menu by checking `Auto jump to exception`
which is disabled by default.

=== Locals

The locals panel will always show the locals bounded for the current point in time.
Expand Down
6 changes: 5 additions & 1 deletion docs/user_guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -2145,6 +2145,10 @@ <h4 id="_exceptions_debugging"><a class="anchor" href="#_exceptions_debugging"><
<div class="paragraph">
<p>Clicking on any of them will position the stepper at that point in time so you can explore what happened before.</p>
</div>
<div class="paragraph">
<p>You can configure FlowStorm to automatically jump to exceptions with the <code>Config</code> menu by checking <code>Auto jump to exception</code>
which is disabled by default.</p>
</div>
</div>
<div class="sect3">
<h4 id="_locals"><a class="anchor" href="#_locals"></a><a class="link" href="#_locals">3.1.6. Locals</a></h4>
Expand Down Expand Up @@ -4214,7 +4218,7 @@ <h2 id="_internals_diagrams_and_documentation"><a class="anchor" href="#_interna
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-11-27 10:55:31 -0300
Last updated 2024-11-29 12:00:48 -0300
</div>
</div>
</body>
Expand Down
3 changes: 2 additions & 1 deletion src-dbg/flow_storm/debugger/events_processor.clj
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@
(ui-utils/run-later
(flows-screen/update-exceptions-combo flow-id)
;; the first time we encounter an exception, navigate to that location
(when (= 1 (count (dbg-state/flow-exceptions flow-id)))
(when (and (:auto-jump-on-exception? (dbg-state/debugger-config))
(= 1 (count (dbg-state/flow-exceptions flow-id))))
(flows-screen/goto-location unwind-data)))))

(defn data-window-push-val-data-event [{:keys [dw-id val-data root?]}]
Expand Down
10 changes: 8 additions & 2 deletions src-dbg/flow_storm/debugger/state.clj
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,14 @@
(s/def :config/debugger-ws-port int?)
(s/def :config/runtime-host string?)
(s/def :config/debug-mode? boolean?)
(s/def :config/auto-jump-on-exception? boolean?)

(s/def ::debugger-config (s/keys :req-un [:config/repl
:config/debugger-host
:config/debugger-ws-port
:config/runtime-host
:config/debug-mode?]))
:config/debug-mode?
:config/auto-jump-on-exception?]))

(s/def :bookmark/id (s/tuple :flow/id :thread/id int?))
(s/def ::bookmarks (s/map-of :bookmark/id string?))
Expand Down Expand Up @@ -257,7 +259,8 @@
:debugger-host (or debugger-host "localhost")
:debugger-ws-port (or ws-port 7722)
:runtime-host (or runtime-host "localhost")
:debug-mode? false}
:debug-mode? false
:auto-jump-on-exception? false}
:bookmarks {}
:visualizers {}
:data-windows {}})
Expand Down Expand Up @@ -300,6 +303,9 @@
(defn debugger-config []
(get @state :debugger-config))

(defn set-auto-jump-on-exception [enable?]
(swap! state assoc-in [:debugger-config :auto-jump-on-exception?] enable?))

(defn toggle-debug-mode []
(swap! state update-in [:debugger-config :debug-mode?] not))

Expand Down
5 changes: 4 additions & 1 deletion src-dbg/flow_storm/debugger/ui/main.clj
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@
:on-click (fn [] (goto-file-line))}])
config-menu (ui/menu :label "_Config"
:items [{:text "Set threads limit"
:on-click (fn [] (ask-and-set-threads-limit))}])
:on-click (fn [] (ask-and-set-threads-limit))}
{:text "Auto jump to exceptions"
:check-item? true
:on-click (fn [enable?] (dbg-state/set-auto-jump-on-exception enable?))}])
help-menu (ui/menu :label "_Help"
:items [{:text "Tutorial"
:on-click (fn []
Expand Down

0 comments on commit 571f3e5

Please sign in to comment.