From 4da6914fb5731b98603173573188f90bf3de4637 Mon Sep 17 00:00:00 2001 From: Marie Katrine Ekeberg Date: Sat, 9 Apr 2022 16:01:56 +0200 Subject: [PATCH 1/3] Minimum possible debug configuration for use with kotlin-debug-adapter --- dap-kotlin.el | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 dap-kotlin.el diff --git a/dap-kotlin.el b/dap-kotlin.el new file mode 100644 index 00000000..5387e4fa --- /dev/null +++ b/dap-kotlin.el @@ -0,0 +1,24 @@ +(require 'lsp-kotlin) +(require 'dap-mode) + +(defun dap-kotlin-populate-launch-args (conf) + ;; we require mainClass and projectRoot to be filled in in the launch configuration. + ;; dap-kotlin does currently not support a fallback if not defined + (-> conf + (dap--put-if-absent :request "launch") + (dap--put-if-absent :name "Kotlin Launch"))) + +(defun dap-kotlin-populate-default-args (conf) + (setq conf (pcase (plist-get conf :request) + ("launch" (dap-kotlin-populate-launch-args conf)) + (_ (error "Unsupported dap-request. Only launch is currently supported")))) + + (-> conf + (dap--put-if-absent :type "kotlin") + (plist-put :dap-server-path (list lsp-kotlin-debug-adapter-path)))) + +(dap-register-debug-provider "kotlin" #'dap-kotlin-populate-default-args) + +;;;###autoload(with-eval-after-load 'lsp-kotlin (require 'dap-kotlin)) + +(provide 'dap-kotlin) From c44554db019aaac74554264bea60be6c002581e1 Mon Sep 17 00:00:00 2001 From: Marie Katrine Ekeberg Date: Sun, 10 Apr 2022 10:15:17 +0200 Subject: [PATCH 2/3] Cleanup --- dap-kotlin.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/dap-kotlin.el b/dap-kotlin.el index 5387e4fa..515a7573 100644 --- a/dap-kotlin.el +++ b/dap-kotlin.el @@ -19,6 +19,4 @@ (dap-register-debug-provider "kotlin" #'dap-kotlin-populate-default-args) -;;;###autoload(with-eval-after-load 'lsp-kotlin (require 'dap-kotlin)) - (provide 'dap-kotlin) From 6c48dba195d112d882dd7b19f89a53e16876912d Mon Sep 17 00:00:00 2001 From: Marie Katrine Ekeberg Date: Sun, 10 Apr 2022 10:17:30 +0200 Subject: [PATCH 3/3] Added information on which debug adapter it is targeting --- dap-kotlin.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dap-kotlin.el b/dap-kotlin.el index 515a7573..2f1fa246 100644 --- a/dap-kotlin.el +++ b/dap-kotlin.el @@ -1,3 +1,6 @@ +;; Commentary: +;; Adapter for https://github.com/fwcd/kotlin-debug-adapter + (require 'lsp-kotlin) (require 'dap-mode)