summaryrefslogtreecommitdiff
path: root/_i18n/en/_posts/2024-04-30-configuring-dape.md
diff options
context:
space:
mode:
Diffstat (limited to '_i18n/en/_posts/2024-04-30-configuring-dape.md')
-rw-r--r--_i18n/en/_posts/2024-04-30-configuring-dape.md78
1 files changed, 0 insertions, 78 deletions
diff --git a/_i18n/en/_posts/2024-04-30-configuring-dape.md b/_i18n/en/_posts/2024-04-30-configuring-dape.md
deleted file mode 100644
index 9a1e383..0000000
--- a/_i18n/en/_posts/2024-04-30-configuring-dape.md
+++ /dev/null
@@ -1,78 +0,0 @@
----
-layout: post
-title: "Configuring Dape: Emacs' new DAP client"
-date: 2024-04-30
-tag: Tutorials
----
-
-A while ago [eglot](https://github.com/joaotavora/eglot), an LSP client, was introduced to emacs core,
-turning it more or less into the emacs' official LSP client, to the detriment of [lsp-mode](https://github.com/emacs-lsp/lsp-mode).
-I love eglot, it's easy to use, configure and it just works, and its integration with other emacs packages and components like
-company and flycheck is seamless. But, if there's an aspect of development that emacs has struggled with, that is, in my opinion, debugging.
-(Although the C/C++ development experience in emacs remains uncontested).
-
-![dape](/assets/images/dape/dape.png){: width="800" }
-
-The developers of the aforementioned lsp-mode also mantain dap-mode, a DAP (LSPs but for debuggers) client for emacs. But
-as you can already guess, it needs lsp-mode, much to the chagrin of eglot users.
-
-But now we have a competitor to dap-mode in the same way that eglot is a competitor to lsp-mode. [Dape](https://github.com/svaante/dape)
-(which isn't that new to be honest, with its first commit dating back to september 29th, 2023).
-
-Unlike dap-mode, it strives to be a minimalist dap client, and it doesn't make use of a launch.json file, relying instead on configurations
-written totally in elisp.
-
-In this post, I'll show an example configuration to use dape with python and flask, but I plan on updating it with more configurations.
-Dape is an extremely interesting project and the fact that it's compatible with ruby's rdbg debug gem catched my eye: emacs can't compete
-right now with vs code as the development environment for ruby, mainly because of debugging. I haven't had luck configuring dap-mode's ruby
-debug mode and it doesn't use rdbg, which is the newest, most up to date, and overall, best gem for debugging ruby. I also would like to check
-debugging vanilla javascript.
-
-But anyway, reading dape's source code we come across this:
-
-```elisp
-command "python"
- command-args ("-m" "debugpy.adapter" "--host" "0.0.0.0" "--port" :autoport)
- port :autoport
- :request "launch"
- :type "python"
- :cwd dape-cwd))
- (common
- `(:args []
- :justMyCode nil
- :console "integratedTerminal"
- :showReturnValue t
- :stopOnEntry nil))
-```
-
-This is the python debugpy configuration. When you install dape, and run it with `M-x dape`, you can select this config.
-And you can assign all the variables you need in order to debug your flask project, mainly, `:args` and `:module`.
-But it's not practical to type all of that everytime you wish to debug your project, so let's jump to your init.file,
-and write the following:
-
-```elisp
-(require 'dape)
-;; Dape configs
-(add-to-list 'dape-configs
- `(debugpy-flask
- modes (python-mode jinja2-mode)
- command "python"
- command-args ["-m" "debugpy.adapter" "--host" "0.0.0.0" "--port" :autoport]
- port :autoport
- :type "python"
- :request "launch"
- :module "flask"
- :args ["--app" "src" "run" "--no-debugger" "--no-reload"]
- :console "integratedTerminal"
- :showReturnValue t
- :justMyCode nil
- :jinja t
- :cwd dape-cwd-fn))
-```
-
-First, we load dape, and then, add another config to the dape-configs list, defined in dape.el.
-As you can see, it is kind of a shameless copy paste of dape's base debugpy config, but with every variable
-set for flask development, like the module to be used (flask) and the CLI arguments it uses (--app, run, etc.)
-There's an issue though, as you can see, the args array defines my app's name as "src", I tried to refer to my app's
-name as a variable, so it could be used for different projects, but alas, I'm not too familiar with dape, or elisp for that matter.
-A possible solution is just to copy this to a .dir-locals.el file for a project wide configuration.