From bf00633d7cd605c063a40d0a550f191144c92ef7 Mon Sep 17 00:00:00 2001 From: Fabio Scotto di Santolo Date: Tue, 16 Dec 2025 22:24:27 +0100 Subject: [PATCH] Configure DAP for C/C++ --- emacs/.emacs.d/.dap-breakpoints | 1 - emacs/.emacs.d/.gitignore | 4 ++ emacs/.emacs.d/.lsp-session-v1 | 1 - emacs/.emacs.d/init.el | 55 +++++++++---------------- emacs/.emacs.d/projectile-bookmarks.eld | 1 - 5 files changed, 23 insertions(+), 39 deletions(-) delete mode 100644 emacs/.emacs.d/.dap-breakpoints delete mode 100644 emacs/.emacs.d/.lsp-session-v1 delete mode 100644 emacs/.emacs.d/projectile-bookmarks.eld diff --git a/emacs/.emacs.d/.dap-breakpoints b/emacs/.emacs.d/.dap-breakpoints deleted file mode 100644 index b9ef7dc..0000000 --- a/emacs/.emacs.d/.dap-breakpoints +++ /dev/null @@ -1 +0,0 @@ -#s(hash-table test equal data ("/var/home/fscotto/Projects/toyforth/toyforth.c" ((:point 1061)))) \ No newline at end of file diff --git a/emacs/.emacs.d/.gitignore b/emacs/.emacs.d/.gitignore index db63090..b400f57 100755 --- a/emacs/.emacs.d/.gitignore +++ b/emacs/.emacs.d/.gitignore @@ -14,6 +14,9 @@ tramp eln-cache projects transient/ +.dap-breakpoints +.lsp-session-v1 +/.extension/** # Org-mode .org-id-locations @@ -47,6 +50,7 @@ flycheck_*.el # projectiles files .projectile +/projectile-bookmarks.eld # directory configuration .dir-locals.el diff --git a/emacs/.emacs.d/.lsp-session-v1 b/emacs/.emacs.d/.lsp-session-v1 deleted file mode 100644 index 064b583..0000000 --- a/emacs/.emacs.d/.lsp-session-v1 +++ /dev/null @@ -1 +0,0 @@ -#s(lsp-session ("/var/home/fscotto/.dotfiles/emacs/.emacs.d/scripts" "/var/home/fscotto/Projects/toyforth") nil #s(hash-table test equal) #s(hash-table test equal) #s(hash-table test equal)) \ No newline at end of file diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 9e152c3..8924df7 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -130,14 +130,6 @@ (or (projectile-project-root) default-directory) default-directory)) -(defun fscotto/project-dashboard () - "Open a project dashboard: root + Magit + LSP." - (interactive) - (let ((root (fscotto/project-root))) - (dired root) - (magit-status root) - (lsp))) - (defun fscotto/project-vterm () "Open vterm in project root." (interactive) @@ -338,7 +330,6 @@ "C-c p v" "Open term in project" "C-c p e" "Edit project config" "C-c p g" "Project Git status" - "C-c p D" "Project Dashboard" "C-c p x" "Open Terminal" "C-c p 4" "Other Window" "C-c p 5" "Other Frame" @@ -488,10 +479,6 @@ (global-set-key (kbd "C-c g") #'fscotto/magit-dispatch) -;; Git leader key (Doom-style) -;; (with-eval-after-load 'magit -;; (define-key global-map (kbd "C-c g") 'magit-dispatch)) - ;; Highlight keywords to remember the activity when coding. (use-package hl-todo :ensure t @@ -574,8 +561,6 @@ (with-eval-after-load 'projectile (define-key projectile-command-map (kbd "g") #'fscotto/project-magit-status)) -(global-set-key (kbd "C-c p D") #'fscotto/project-dashboard) - ;; Add autocomplete feature to Emacs (use-package company :ensure t @@ -698,38 +683,36 @@ ;; Control (global-set-key (kbd "C-c l R") #'lsp-restart-workspace)) -;;;;;;;;;;;;;;;;;;;;;; -;; Enable debuggers ;; -;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Debugger Adapter Protocol ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (use-package dap-mode :ensure t :after lsp-mode - :commands dap-debug + :hook (lsp-mode . dap-mode) :init - ;; Debug prefix + ;; Enabling only some features (setq dap-auto-configure-features '(sessions locals controls tooltip)) :config (dap-mode 1) (dap-ui-mode 1) + (dap-ui-controls-mode 1) (dap-tooltip-mode 1) - + (tooltip-mode 1) ;; Auto show breakpoints + REPL (setq dap-ui-buffer-configurations '((dap-ui-repl . ((side . right) (slot . 1) (window-width . 0.33))) (dap-ui-locals . ((side . right) (slot . 2) (window-width . 0.33))) - (dap-ui-breakpoints . ((side . left) (slot . 1) (window-width . 0.20)))))) - -;; For C/C++ -(require 'dap-gdb-lldb) -(setq dap-gdb-lldb-debug-program '("gdb")) - -;; For Go -(require 'dap-go) - -;; For Python -(require 'dap-python) -(setq dap-python-debugger 'debugpy) + (dap-ui-breakpoints . ((side . left) (slot . 1) (window-width . 0.20))))) + ;; Loading DAP adapters + ;; For C/C++ + (require 'dap-cpptools) + ;; For Go + (require 'dap-dlv-go) + ;; For Python + (require 'dap-python) + (setq dap-python-debugger 'debugpy)) (with-eval-after-load 'dap-mode (global-set-key (kbd "C-c d d") #'dap-debug) @@ -741,9 +724,9 @@ (global-set-key (kbd "C-c d r") #'dap-restart-frame) (global-set-key (kbd "C-c d q") #'dap-disconnect)) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;; Formatters ;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;; +;; Formatters ;; +;;;;;;;;;;;;;;;; ;; GOTCHA review this region (use-package reformatter diff --git a/emacs/.emacs.d/projectile-bookmarks.eld b/emacs/.emacs.d/projectile-bookmarks.eld deleted file mode 100644 index bc20dc8..0000000 --- a/emacs/.emacs.d/projectile-bookmarks.eld +++ /dev/null @@ -1 +0,0 @@ -("~/.dotfiles/" "~/Projects/toyforth/" "~/Projects/workstation/" "~/Projects/system-programming/" "~/Projects/pymorg/" "~/Projects/operating-systems/" "~/Projects/fileserver/" "~/Projects/exkernel/" "~/Projects/docker-compose/") \ No newline at end of file