mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-31 14:43:40 -05:00
feat(sml): add treesit (and lsp) support
This commit is contained in:
@@ -4,17 +4,23 @@
|
||||
#+since: 21.12.0
|
||||
|
||||
* Description :unfold:
|
||||
THis module adds [[https://smlfamily.github.io/][SML (Standard ML) programming language]] support to Doom Emacs.
|
||||
This module adds [[https://smlfamily.github.io/][SML (Standard ML) programming language]] support to Doom Emacs.
|
||||
|
||||
** Maintainers
|
||||
*This module needs a maintainer.* [[doom-contrib-maintainer:][Become a maintainer?]]
|
||||
|
||||
** Module flags
|
||||
/This module has no flags./
|
||||
- +lsp ::
|
||||
Enable LSP support for ~sml-mode~/~sml-ts-mode~. Requires [[doom-module::tools lsp]]
|
||||
and a langserver (supports [[https://github.com/azdavis/millet][millet-ls]]).
|
||||
- +tree-sitter ::
|
||||
Leverages tree-sitter for better syntax highlighting and structural text
|
||||
editing. Requires [[doom-module::tools tree-sitter]].
|
||||
|
||||
** Packages
|
||||
- [[doom-package:company-mlton]] if [[doom-module::completion company]]
|
||||
- [[doom-package:sml-mode]]
|
||||
- [[doom-package:sml-ts-mode]] if [[doom-module:+tree-sitter]]
|
||||
|
||||
** Hacks
|
||||
/No hacks documented for this module./
|
||||
|
@@ -3,11 +3,14 @@
|
||||
(use-package! sml-mode
|
||||
:mode "\\.s\\(?:ml\\|ig\\)\\'"
|
||||
:config
|
||||
(set-repl-handler! 'sml-mode #'run-sml)
|
||||
(set-formatter! 'smlformat '("smlformat") :modes '(sml-mode))
|
||||
(set-repl-handler! '(sml-mode sml-ts-mode) #'run-sml)
|
||||
(set-formatter! 'smlformat '("smlformat") :modes '(sml-mode sml-ts-mode))
|
||||
|
||||
(when (modulep! +lsp)
|
||||
(add-hook 'sml-mode-local-vars-hook #'lsp! 'append))
|
||||
|
||||
;; don't auto-close apostrophes (type 'a = foo) and backticks (`Foo)
|
||||
(sp-with-modes 'sml-mode
|
||||
(sp-with-modes '(sml-mode sml-ts-mode)
|
||||
(sp-local-pair "'" nil :actions nil)
|
||||
(sp-local-pair "`" nil :actions nil))
|
||||
|
||||
@@ -23,6 +26,19 @@
|
||||
:desc "Run region" "r" #'sml-prog-proc-send-region))
|
||||
|
||||
|
||||
;; TODO: Mirror sml-mode keybinds to ts-mode
|
||||
(use-package! sml-ts-mode
|
||||
:when (modulep! +tree-sitter)
|
||||
:when (fboundp 'treesit-available-p)
|
||||
:defer t
|
||||
:init
|
||||
(set-tree-sitter! 'sml-mode 'sml-ts-mode
|
||||
'((sml :url "https://github.com/MatthewFluet/tree-sitter-sml")))
|
||||
:config
|
||||
(when (modulep! +lsp)
|
||||
(add-hook 'sml-ts-mode-local-vars-hook #'lsp! 'append)))
|
||||
|
||||
|
||||
(use-package! company-mlton
|
||||
:when (modulep! :completion company)
|
||||
:hook (sml-mode . company-mlton-init)
|
||||
|
@@ -1,5 +1,9 @@
|
||||
;;; lang/sml/doctor.el -*- lexical-binding: t; -*-
|
||||
|
||||
(assert! (or (not (modulep! +tree-sitter))
|
||||
(modulep! :tools tree-sitter))
|
||||
"This module requires (:tools tree-sitter)")
|
||||
|
||||
(when (modulep! :editor format)
|
||||
(unless (executable-find "smlformat")
|
||||
(warn! "Couldn't find smlformat. Formatting will be disabled.")))
|
||||
|
@@ -6,3 +6,5 @@
|
||||
(package! company-mlton
|
||||
:recipe (:host github :repo "MatthewFluet/company-mlton" :files ("*.el" "*.basis"))
|
||||
:pin "9b09d209b4767a2af24784fb5321390ed1d445bf"))
|
||||
(when (modulep! +tree-sitter)
|
||||
(package! sml-ts-mode :pin "d2dabcc9d8f91eeee7048641e4c80fabb3583194"))
|
||||
|
Reference in New Issue
Block a user