|
| 1 | +;;; dap-mode/dap-ocaml.el -*- lexical-binding: t; -*- |
| 2 | + |
| 3 | +;; Copyright (C) 2018 Austin Theriault |
| 4 | + |
| 5 | +;; Author: Austin Theriault <[email protected]> |
| 6 | +;; Keywords: languages |
| 7 | + |
| 8 | +;; This program is free software; you can redistribute it and/or modify |
| 9 | +;; it under the terms of the GNU General Public License as published by |
| 10 | +;; the Free Software Foundation, either version 3 of the License, or |
| 11 | +;; (at your option) any later version. |
| 12 | + |
| 13 | +;; This program is distributed in the hope that it will be useful, |
| 14 | +;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | +;; GNU General Public License for more details. |
| 17 | + |
| 18 | +;; You should have received a copy of the GNU General Public License |
| 19 | +;; along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 20 | + |
| 21 | +;; URL: https://github.com/yyoncho/dap-mode |
| 22 | +;; Package-Requires: ((emacs "25.1") (dash "2.14.1") (lsp-mode "4.0")) |
| 23 | +;; Version: 0.2 |
| 24 | + |
| 25 | +;;; Commentary: |
| 26 | +;; Adapter for OCaml Earlybird (https://github.com/hackwaly/ocamlearlybird) |
| 27 | + |
| 28 | +;;; Code: |
| 29 | + |
| 30 | +(require 'dap-mode) |
| 31 | + |
| 32 | +(defcustom dap-ocaml-executable "ocamlearlybird" |
| 33 | + "Path to the OCaml Earlybird executable." |
| 34 | + :group 'dap-ocaml |
| 35 | + :risky t |
| 36 | + :type 'file) |
| 37 | + |
| 38 | +(defun dap-ocaml--populate-start-file-args (conf) |
| 39 | + "Populate CONF with the start file argument." |
| 40 | + (-> conf |
| 41 | + (dap--put-if-absent :console "internalConsole") ;; integratedTerminal doesn't work |
| 42 | + (dap--put-if-absent :dap-server-path (list dap-ocaml-executable "debug")))) |
| 43 | + |
| 44 | +(dap-register-debug-provider "ocaml.earlybird" 'dap-ocaml--populate-start-file-args) |
| 45 | +(dap-register-debug-template "OCaml Debug Template" |
| 46 | + (list :type "ocaml.earlybird" |
| 47 | + :request "launch" |
| 48 | + :name "OCaml::Run" |
| 49 | + :program nil |
| 50 | + :arguments nil)) |
| 51 | + |
| 52 | + |
| 53 | +(provide 'dap-ocaml) |
| 54 | +;;; dap-ocaml.el ends here |
0 commit comments