Skip to content

Commit 685168e

Browse files
authored
Add Erlang support (#489)
* Add Erlang support * Add Erlang screenshot
1 parent 2354d55 commit 685168e

File tree

5 files changed

+61
-1
lines changed

5 files changed

+61
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ DAP-CLIENTS := dap-chrome.el dap-cpptools.el dap-edge.el \
1212
dap-elixir.el dap-firefox.el dap-gdb-lldb.el \
1313
dap-go.el dap-lldb.el dap-netcore.el dap-node.el \
1414
dap-php.el dap-pwsh.el dap-python.el dap-ruby.el \
15-
dap-codelldb.el
15+
dap-codelldb.el dap-erlang.el
1616

1717
TEST-FILES := test/windows-bootstrap.el $(shell ls test/dap-*.el)
1818
LOAD-FILE = -l $(test-file)

dap-erlang.el

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
;;; dap-erlang.el --- Debug Adapter Protocol mode for Erlang -*- lexical-binding: t; -*-
2+
3+
;; Copyright (C) 2018 Ivan Yonchovski
4+
5+
;; Author: Ivan Yonchovski <[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 https://github.com/erlang-ls/erlang_ls
27+
;; Created by Roberto Aloi (@robertoaloi)
28+
29+
;;; Code:
30+
31+
(require 'dap-mode)
32+
33+
(defun dap-erlang--populate-start-file-args (conf)
34+
"Populate CONF with the required arguments."
35+
(-> conf
36+
(plist-put :dap-server-path '("els_dap"))
37+
(plist-put :projectDir (lsp-find-session-folder (lsp-session) (buffer-file-name)))
38+
(plist-put :cwd (lsp-find-session-folder (lsp-session) (buffer-file-name)))
39+
))
40+
(dap-register-debug-provider "erlang" 'dap-erlang--populate-start-file-args)
41+
42+
(provide 'dap-erlang)
43+
;;; dap-erlang.el ends here

docs/page/configuration.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,19 @@ Then when you do `dap-debug-edit-template` and select Elixir which will
199199
generate runnable debug configuration. For more details on supported
200200
settings by the Elixir Debug Server refer to its documentation.
201201

202+
## Erlang
203+
204+
Make sure that you have properly configured `Erlang` and that you have
205+
[Erlang LS](https://github.com/erlang-ls/erlang_ls) binaries on the
206+
path and put in your emacs configuration.
207+
208+
``` elisp
209+
(require 'dap-erlang)
210+
```
211+
212+
For more information about DAP support in Erlang LS please refer to
213+
[the official documentation](https://erlang-ls.github.io/).
214+
202215
## PHP
203216

204217
Simplify setup of vscode extension with `dap-php-setup` after requiring

docs/page/gallery.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ Gallery
2424
## Javascript
2525

2626
![Javascript via Firefox debugger](../screenshots/javascript.png)
27+
28+
## Erlang
29+
30+
![Erlang via Erlang LS](../screenshots/erlang.png)

screenshots/erlang.png

1.12 MB
Loading

0 commit comments

Comments
 (0)