Debugging & Auto Formatting

- Add keybindings for debugging
- Enable formatting on save
- Configure python DAP mode to use debugpy
This commit is contained in:
Sravan Balaji
2022-07-02 08:46:30 -04:00
parent 5fda254ac2
commit 9ef9f09c22
3 changed files with 81 additions and 2 deletions

View File

@@ -30,6 +30,7 @@
- [[#file-extension-mode-association][File Extension Mode Association]] - [[#file-extension-mode-association][File Extension Mode Association]]
- [[#automatically-revert-buffers-for-changed-files][Automatically Revert Buffers For Changed Files]] - [[#automatically-revert-buffers-for-changed-files][Automatically Revert Buffers For Changed Files]]
- [[#rainbow-mode][Rainbow Mode]] - [[#rainbow-mode][Rainbow Mode]]
- [[#debugging][Debugging]]
- [[#packagesel][packages.el]] - [[#packagesel][packages.el]]
- [[#packages][Packages]] - [[#packages][Packages]]
@@ -110,7 +111,7 @@ Alternatively, press =gd= (or =C-c c d=) on a module to browse its directory (fo
(evil +everywhere) ; come to the dark side, we have cookies (evil +everywhere) ; come to the dark side, we have cookies
file-templates ; auto-snippets for empty files file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding fold ; (nigh) universal code folding
;;(format +onsave) ; automated prettiness (format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys ;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim ;;lispy ; vim for lisp, for people who don't like vim
multiple-cursors ; editing in many places at once multiple-cursors ; editing in many places at once
@@ -513,6 +514,50 @@ Revert buffers when the underlying file has changed
(global-rainbow-mode 1) (global-rainbow-mode 1)
#+END_SRC #+END_SRC
*** Debugging
**** Keybindings
#+BEGIN_SRC emacs-lisp :tangle config.el
(map! :map dap-mode-map
:leader
:prefix ("d" . "dap")
;; basics
:desc "dap next" "n" #'dap-next
:desc "dap step in" "i" #'dap-step-in
:desc "dap step out" "o" #'dap-step-out
:desc "dap continue" "c" #'dap-continue
:desc "dap hydra" "h" #'dap-hydra
:desc "dap debug restart" "r" #'dap-debug-restart
:desc "dap debug" "s" #'dap-debug
;; debug
:prefix ("dd" . "Debug")
:desc "dap debug recent" "r" #'dap-debug-recent
:desc "dap debug last" "l" #'dap-debug-last
;; eval
:prefix ("de" . "Eval")
:desc "eval" "e" #'dap-eval
:desc "eval region" "r" #'dap-eval-region
:desc "eval thing at point" "s" #'dap-eval-thing-at-point
:desc "add expression" "a" #'dap-ui-expressions-add
:desc "remove expression" "d" #'dap-ui-expressions-remove
:prefix ("db" . "Breakpoint")
:desc "dap breakpoint toggle" "b" #'dap-breakpoint-toggle
:desc "dap breakpoint condition" "c" #'dap-breakpoint-condition
:desc "dap breakpoint hit count" "h" #'dap-breakpoint-hit-condition
:desc "dap breakpoint log message" "l" #'dap-breakpoint-log-message)
#+END_SRC
**** Python
#+BEGIN_SRC emacs-lisp :tangle config.el
(after! dap-mode
(setq dap-python-debugger 'debugpy))
#+END_SRC
** packages.el ** packages.el
To install a package with Doom you must declare them here and run =doom sync= on the command line, then restart Emacs for the changes to take effect -- or use =M-x doom/reload=. To install a package with Doom you must declare them here and run =doom sync= on the command line, then restart Emacs for the changes to take effect -- or use =M-x doom/reload=.

View File

@@ -84,3 +84,37 @@
(define-globalized-minor-mode global-rainbow-mode rainbow-mode (define-globalized-minor-mode global-rainbow-mode rainbow-mode
(lambda () (rainbow-mode 1))) (lambda () (rainbow-mode 1)))
(global-rainbow-mode 1) (global-rainbow-mode 1)
(map! :map dap-mode-map
:leader
:prefix ("d" . "dap")
;; basics
:desc "dap next" "n" #'dap-next
:desc "dap step in" "i" #'dap-step-in
:desc "dap step out" "o" #'dap-step-out
:desc "dap continue" "c" #'dap-continue
:desc "dap hydra" "h" #'dap-hydra
:desc "dap debug restart" "r" #'dap-debug-restart
:desc "dap debug" "s" #'dap-debug
;; debug
:prefix ("dd" . "Debug")
:desc "dap debug recent" "r" #'dap-debug-recent
:desc "dap debug last" "l" #'dap-debug-last
;; eval
:prefix ("de" . "Eval")
:desc "eval" "e" #'dap-eval
:desc "eval region" "r" #'dap-eval-region
:desc "eval thing at point" "s" #'dap-eval-thing-at-point
:desc "add expression" "a" #'dap-ui-expressions-add
:desc "remove expression" "d" #'dap-ui-expressions-remove
:prefix ("db" . "Breakpoint")
:desc "dap breakpoint toggle" "b" #'dap-breakpoint-toggle
:desc "dap breakpoint condition" "c" #'dap-breakpoint-condition
:desc "dap breakpoint hit count" "h" #'dap-breakpoint-hit-condition
:desc "dap breakpoint log message" "l" #'dap-breakpoint-log-message)
(after! dap-mode
(setq dap-python-debugger 'debugpy))

View File

@@ -42,7 +42,7 @@
(evil +everywhere) ; come to the dark side, we have cookies (evil +everywhere) ; come to the dark side, we have cookies
file-templates ; auto-snippets for empty files file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding fold ; (nigh) universal code folding
;;(format +onsave) ; automated prettiness (format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys ;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim ;;lispy ; vim for lisp, for people who don't like vim
multiple-cursors ; editing in many places at once multiple-cursors ; editing in many places at once