Browse Source

Remove all breakpoints in a buffer before killing it

workspaces
Nicolas Petton 3 years ago
parent
commit
92dc754d97
Signed by: nico GPG Key ID: 233587A47C207910
3 changed files with 15 additions and 0 deletions
  1. +6
    -0
      indium-interaction.el
  2. +1
    -0
      test/test-helper.el
  3. +8
    -0
      test/unit/indium-interaction-test.el

+ 6
- 0
indium-interaction.el View File

@ -299,6 +299,11 @@ hitting a breakpoint."
(when (and indium-interaction-mode indium-current-connection)
(indium-update-script-source)))
(defun indium-interaction-kill-buffer ()
"Remove all breakpoints prior to killing the current buffer."
(when indium-interaction-mode
(indium-breakpoint-remove-all)))
(defun indium-update-script-source ()
"Update the script source of the backend from the current buffer.
update all breakpoints set in the current buffer as well."
@ -322,6 +327,7 @@ update all breakpoints set in the current buffer as well."
(user-error "There is already a breakpoint on the current line")))
(add-hook 'before-save-hook #'indium-interaction-update)
(add-hook 'kill-buffer-hook #'indium-interaction-kill-buffer)
(provide 'indium-interaction)
;;; indium-interaction.el ends here

+ 1
- 0
test/test-helper.el View File

@ -61,6 +61,7 @@ buffer in `js2-mode' with CONTENTS."
(goto-char (point-max))
(js2-mode)
(js2-parse)
(indium-interaction-mode 1)
,@body))
(defmacro with-temp-workspace-file (&rest body)


+ 8
- 0
test/unit/indium-interaction-test.el View File

@ -162,5 +162,13 @@
(indium-add-conditional-breakpoint "foo")
(expect #'indium-add-breakpoint :to-have-been-called-with "foo"))))))
(describe "Interaction mode"
(it "should remove breakpoints when killing a buffer"
(spy-on 'indium-breakpoint-remove-all)
(with-js2-buffer "let a = 1;"
(indium-add-breakpoint)
(kill-buffer)
(expect #'indium-breakpoint-remove-all :to-have-been-called))))
(provide 'indium-interaction-test)
;;; indium-interaction-test.el ends here

Loading…
Cancel
Save