2018-11-25 16:50:46 +00:00
|
|
|
;;; packages.el --- DAP mode functions File for Spacemacs
|
|
|
|
;;
|
2021-03-22 20:11:29 +00:00
|
|
|
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
|
2018-11-25 16:50:46 +00:00
|
|
|
;;
|
|
|
|
;; Author: Ivan Yonchovski (yyoncho@gmail.com)
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
2021-03-24 03:31:44 +00:00
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
;;
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
;;
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2018-11-25 16:50:46 +00:00
|
|
|
|
|
|
|
(defconst dap-packages
|
2020-04-16 18:23:28 +00:00
|
|
|
'(dap-mode
|
|
|
|
(posframe (not (version< emacs-version "26.1")))))
|
2018-11-25 16:50:46 +00:00
|
|
|
|
|
|
|
(defun dap/init-dap-mode ()
|
|
|
|
(use-package dap-mode
|
|
|
|
:after (lsp-mode)
|
2019-05-19 10:47:23 +00:00
|
|
|
:hook ((dap-ui-sessions-mode . evil-evilified-state)
|
|
|
|
(dap-ui-breakpoints-ui-list-mode . evil-evilified-state)
|
|
|
|
(dap-ui-locals-mode . evil-evilified-state)
|
|
|
|
(dap-ui-inspect-mode . evil-evilified-state))
|
2018-11-25 16:50:46 +00:00
|
|
|
:config
|
2019-09-29 17:10:47 +00:00
|
|
|
(progn
|
|
|
|
(dap-mode 1)
|
|
|
|
(dap-ui-mode 1)
|
2019-09-30 01:30:53 +00:00
|
|
|
;; mouse support
|
2019-09-29 17:10:47 +00:00
|
|
|
(spacemacs|add-toggle dap-mouse
|
|
|
|
:status dap-tooltip-mode
|
|
|
|
:on (progn (dap-tooltip-mode)
|
|
|
|
(tooltip-mode))
|
|
|
|
:off (progn (dap-tooltip-mode -1)
|
|
|
|
(tooltip-mode -1))
|
|
|
|
:documentation "Enable mouse support in DAP mode.")
|
|
|
|
(when dap-enable-mouse-support
|
2019-09-30 01:30:53 +00:00
|
|
|
(spacemacs/toggle-dap-mouse-on))
|
2020-04-14 16:32:25 +00:00
|
|
|
|
2020-04-16 18:23:28 +00:00
|
|
|
(unless (version< emacs-version "26.1")
|
|
|
|
(spacemacs|add-toggle dap-ui-controls
|
|
|
|
:status dap-ui-controls-mode
|
|
|
|
:on (dap-ui-controls-mode)
|
|
|
|
:off (dap-ui-controls-mode -1)
|
|
|
|
:documentation "Enable dap-ui-controls-mode"))
|
|
|
|
|
|
|
|
(when dap-enable-ui-controls
|
|
|
|
(spacemacs/toggle-dap-ui-controls-on))
|
|
|
|
|
2019-09-30 01:30:53 +00:00
|
|
|
;; key bindings
|
2020-04-14 16:32:25 +00:00
|
|
|
(let ((bindings (list
|
|
|
|
;; transient state
|
|
|
|
"d." #'dap-hydra
|
|
|
|
;; repl
|
|
|
|
"d'" #'dap-ui-repl
|
|
|
|
;; abandon
|
|
|
|
"da" #'dap-disconnect
|
|
|
|
"dA" #'dap-delete-all-sessions
|
|
|
|
;; breakpoints
|
|
|
|
"dbb" #'dap-breakpoint-toggle
|
|
|
|
"dbc" #'dap-breakpoint-condition
|
|
|
|
"dbl" #'dap-breakpoint-log-message
|
|
|
|
"dbh" #'dap-breakpoint-hit-condition
|
|
|
|
"dba" #'dap-breakpoint-add
|
|
|
|
"dbd" #'dap-breakpoint-delete
|
|
|
|
"dbD" #'dap-breakpoint-delete-all
|
|
|
|
;; debuging/running
|
|
|
|
"ddd" #'dap-debug
|
|
|
|
"dde" #'dap-debug-edit-template
|
|
|
|
"ddl" #'dap-debug-last
|
|
|
|
"ddr" #'dap-debug-recent
|
|
|
|
;; eval
|
|
|
|
"dee" #'dap-eval
|
|
|
|
"der" #'dap-eval-region
|
|
|
|
"det" #'dap-eval-thing-at-point
|
|
|
|
"det" #'dap-ui-expressions-add
|
|
|
|
;; inspect
|
|
|
|
"dIi" #'dap-ui-inspect
|
|
|
|
"dIr" #'dap-ui-inspect-region
|
|
|
|
"dIt" #'dap-ui-inspect-thing-at-point
|
|
|
|
;; stepping
|
|
|
|
"dc" #'dap-continue
|
|
|
|
"di" #'dap-step-in
|
|
|
|
"do" #'dap-step-out
|
|
|
|
"dr" #'dap-restart-frame
|
|
|
|
"ds" #'dap-next
|
|
|
|
"dv" #'dap-ui-inspect-thing-at-point
|
|
|
|
;; switching
|
|
|
|
"dSs" #'dap-switch-session
|
|
|
|
"dSt" #'dap-switch-thread
|
|
|
|
"dSf" #'dap-switch-frame
|
|
|
|
;; toggles
|
|
|
|
"dTm" 'spacemacs/toggle-dap-mouse
|
|
|
|
;; windows
|
|
|
|
"dwo" #'dap-go-to-output-buffer
|
|
|
|
"dwl" #'dap-ui-locals
|
|
|
|
"dws" #'dap-ui-sessions
|
|
|
|
"dwb" #'dap-ui-breakpoints))
|
|
|
|
(prefixes '(("d" . "debug")
|
|
|
|
("db" . "breakpoints")
|
|
|
|
("dd" . "debugging")
|
|
|
|
("de" . "eval")
|
|
|
|
("dI" . "inspect")
|
|
|
|
("dS" . "switch")
|
|
|
|
("dT" . "toggles")
|
|
|
|
("dw" . "debug windows"))))
|
|
|
|
|
2020-12-13 21:05:16 +00:00
|
|
|
;; Set global prefixes
|
2020-04-14 16:32:25 +00:00
|
|
|
(mapc (lambda (cons)
|
|
|
|
(spacemacs/declare-prefix (car cons) (cdr cons)))
|
|
|
|
prefixes)
|
|
|
|
|
2020-12-13 21:05:16 +00:00
|
|
|
;; Set global key bindings
|
|
|
|
(apply #'spacemacs/set-leader-keys bindings)
|
|
|
|
|
|
|
|
;; Do all mode specific dap bindings
|
2020-04-14 16:32:25 +00:00
|
|
|
(dolist (mode spacemacs--dap-supported-modes)
|
|
|
|
|
|
|
|
;; avoid clash with other debug key bindings
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode "db" nil)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode "dd" nil)
|
2019-09-30 01:30:53 +00:00
|
|
|
|
2020-12-13 21:05:16 +00:00
|
|
|
;; Set prefixes
|
2020-04-14 16:32:25 +00:00
|
|
|
(mapc (lambda (cons)
|
2020-05-16 20:18:29 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode mode (concat "m" (car cons)) (cdr cons)))
|
2020-12-13 21:05:16 +00:00
|
|
|
prefixes)
|
|
|
|
|
|
|
|
;; Set bindings
|
|
|
|
(apply #'spacemacs/set-leader-keys-for-major-mode mode bindings))))))
|
|
|
|
|
|
|
|
|
2020-04-16 18:23:28 +00:00
|
|
|
|
|
|
|
(defun dap/init-posframe ()
|
|
|
|
(unless (version< emacs-version "26.1")
|
|
|
|
(use-package posframe)))
|