Skip to content

Commit 7a50934

Browse files
authored
Add Standard ML (Millet) (#3914)
1 parent 2657f81 commit 7a50934

File tree

3 files changed

+100
-0
lines changed

3 files changed

+100
-0
lines changed

clients/lsp-sml.el

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
;;; lsp-sml.el --- Standard ML client settings -*- lexical-binding: t; -*-
2+
3+
;; Copyright (c) 2023 Ariel Davis
4+
5+
;; Author: Ariel Davis <ariel.z.davis@icloud.com>
6+
;; Keywords: langauges, lsp, sml, standard-ml, millet
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+
;;; Commentary:
22+
23+
;; lsp-sml client via Millet
24+
25+
;;; Code:
26+
27+
(require 'lsp-mode)
28+
(require 'lsp-completion)
29+
30+
(defgroup lsp-sml nil
31+
"LSP support for Standard ML, using the Millet language server."
32+
:link '(url-link "https://github.com/azdavis/millet")
33+
:group 'lsp-mode)
34+
35+
(defcustom lsp-sml-millet-format-engine "none"
36+
"**WARNING: THE FORMATTER IS HIGHLY EXPERIMENTAL.
37+
IT MAY IRREVOCABLY DESTROY SOME OR ALL OF YOUR CODE.**
38+
39+
How to format open SML files on save."
40+
:type '(choice (const :tag "No formatting." "none")
41+
(const :tag "Naive formatting." "naive")
42+
(const :tag "Formatting provided by https://github.com/shwestrick/smlfmt." "smlfmt"))
43+
:group 'lsp-sml)
44+
45+
(defcustom lsp-sml-millet-server-diagnostics-filter "syntax"
46+
"What diagnostics to send per file."
47+
:type '(choice (const :tag "No filter, i.e. all available diagnostics are sent." "none")
48+
(const :tag "If there are syntax errors (lex, parse, etc),
49+
send only those, and do not send e.g. statics diagnostics." "syntax"))
50+
:group 'lsp-sml)
51+
52+
(defcustom lsp-sml-millet-server-diagnostics-moreInfoHint-enable t
53+
"Show a hint on diagnostic messages about clicking the error code number for more information."
54+
:type 'boolean
55+
:group 'lsp-sml)
56+
57+
(defcustom lsp-sml-millet-server-diagnostics-onChange-enable nil
58+
"Send diagnostics when file contents change before saving."
59+
:type 'boolean
60+
:group 'lsp-sml)
61+
62+
(defcustom lsp-sml-millet-server-hover-token-enable t
63+
"Show information about tokens on hover."
64+
:type 'boolean
65+
:group 'lsp-sml)
66+
67+
(defcustom lsp-sml-millet-server-path "millet-ls"
68+
"Path to the `millet-ls` executable."
69+
:type 'string
70+
:group 'lsp-sml)
71+
72+
(lsp-register-custom-settings
73+
'(("millet.format.engine" lsp-sml-millet-format-engine)
74+
("millet.server.diagnostics.filter" lsp-sml-millet-server-diagnostics-filter)
75+
("millet.server.diagnostics.moreInfoHint.enable" lsp-sml-millet-server-diagnostics-moreInfoHint-enable)
76+
("millet.server.diagnostics.onChange.enable" lsp-sml-millet-server-diagnostics-onChange-enable)
77+
("millet.server.hover.token.enable" lsp-sml-millet-server-hover-token-enable)
78+
("millet.server.path" lsp-sml-millet-server-path)))
79+
80+
(lsp-register-client
81+
(make-lsp-client :new-connection (lsp-stdio-connection
82+
(lambda () lsp-sml-millet-server-path))
83+
:activation-fn (lsp-activate-on "sml" "millet.toml")
84+
:language-id "sml"
85+
:priority -1
86+
:server-id 'millet))
87+
88+
(lsp-consistency-check lsp-sml)
89+
90+
(provide 'lsp-sml)
91+
;;; lsp-sml.el ends here

docs/lsp-clients.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,14 @@
451451
"installation-url": "https://github.com/artempyanykh/marksman",
452452
"debugger": "Not available"
453453
},
454+
{
455+
"name": "millet",
456+
"full-name": "Standard ML (Millet)",
457+
"server-name": "millet",
458+
"server-url": "https://github.com/azdavis/millet",
459+
"installation-url": "https://github.com/azdavis/millet",
460+
"debugger": "Not available"
461+
},
454462
{
455463
"name": "mint",
456464
"full-name": "mint-lang",

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ nav:
132132
- Rust (rls): page/lsp-rust-rls.md
133133
- Scala: https://emacs-lsp.github.io/lsp-metals
134134
- SQL (sqls): page/lsp-sqls.md
135+
- Standard ML (Millet): page/lsp-sml.md
135136
- Svelte: page/lsp-svelte.md
136137
- Swift: https://emacs-lsp.github.io/lsp-sourcekit
137138
- Terraform (terraform-lsp): page/lsp-terraform.md

0 commit comments

Comments
 (0)