-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathontop-gleam.el
99 lines (78 loc) · 3.13 KB
/
ontop-gleam.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
;;; ontop-gleam.el --- Gleam configuration -*- lexical-binding: t; -*-
;; This file is part of Emacs ONTOP
;; https://github.com/monkeyjunglejuice/emacs.ontop
;;; Commentary:
;; You can also use this file/configuration independently from Emacs ONTOP
;; Load it from anywhere via `(load-file "/path/to/ontop-gleam.el")'.
;;; Code:
;; ____________________________________________________________________________
;;; USE-PACKAGE
;; <https://github.com/jwiegley/use-package>
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package nil))
(eval-when-compile
(require 'use-package))
;; ____________________________________________________________________________
;;; GLEAM TS MODE
;; <https://github.com/gleam-lang/gleam-mode>
(use-package gleam-ts-mode
:ensure t
:mode (rx ".gleam" eos))
;; Unless you have the Gleam tree-sitter grammar installed and treesit knows
;; where to find it, you'll want to run M-x gleam-ts-install-grammar. It should
;; only take a moment, but does require that your OS has a C compiler available.
;; ____________________________________________________________________________
;;; REPL
;; Gleam has no REPL yet!
;; <https://github.com/gleam-lang/gleam/discussions/1305>
;; <https://github.com/gleam-lang/gleam/issues/25>
;; ____________________________________________________________________________
;;; LANGUAGE SERVER
;; <https://github.com/joaotavora/eglot/blob/master/MANUAL.md>
;; Common keybindings are configured in `./ontop-core.el'
;; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
;;; GLEAM LSP
;; <https://gleam.run/language-server>
(use-package eglot
:ensure t
:custom
;; A longer timeout seems required for the first run in a new project
(eglot-connect-timeout 60) ; default: 30
:config
(add-to-list 'eglot-server-programs
'((gleam-ts-mode) . ("gleam" "lsp")))
:hook
;; Start language server automatically
((gleam-ts-mode) . eglot-ensure)
;; Tell the language server to format the buffer before saving
((gleam-ts-mode) .
(lambda ()
(add-hook 'before-save-hook
#'eglot-format-buffer nil 'local))))
;; ____________________________________________________________________________
;;; MIX GLEAM
;; <https://github.com/gleam-lang/mix_gleam>
;; (use-package mix
;; :ensure t
;; :diminish mix-minor-mode
;; :hook
;; ((gleam-ts-mode) . mix-minor-mode))
;; ____________________________________________________________________________
;;; ERLANG
;; <https://www.erlang.org/doc/apps/tools/erlang_mode_chapter.html>
(use-package erlang
:ensure t)
;; ____________________________________________________________________________
;;; PARENTHESIS DISPLAY
;; Rainbow-delimiters color-coding of nested parens is already enabled
;; for all prog-modes in `ontop-core.el'
;; Make parens styleable, e.g. more or less prominent
;; <https://github.com/tarsius/paren-face>
;; (use-package paren-face
;; :ensure t
;; :hook
;; (gleam-ts-mode . paren-face-mode))
;; _____________________________________________________________________________
(provide 'ontop-gleam)
;;; ontop-gleam.el ends here