merge: pull request #6369 from elken/feature/editor-format-refactor

This commit is contained in:
Henrik Lissner 2023-09-14 01:19:01 +02:00 committed by GitHub
commit a234d8e9c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
89 changed files with 526 additions and 728 deletions

View file

@ -34,6 +34,7 @@ you [[https://plaintextaccounting.org/][manage your money in plain text]].
This module requires:
- [[https://github.com/beancount/beancount][beancount]], for generating reports
- [[https://beancount.github.io/fava/][fava]], for a web interface for your ledgers
- [[doom-executable:bean-format]], if [[doom-module::editor format]]
* TODO Usage
#+begin_quote

View file

@ -133,6 +133,11 @@ rdm &
rc -J $PROJECT_ROOT # loads PROJECT_ROOT's compile_commands.json
#+end_src
** =:editor format=
The formatter used is [[doom-executable:clang-format]] which should be installed alongside =clang=.
For more info, see [[doom-module::editor format]].
* TODO Usage
#+begin_quote
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]]

View file

@ -48,6 +48,17 @@ This is ignored by ccls.")
(set-docsets! 'c-mode "C")
(set-docsets! 'c++-mode "C++" "Boost")
(set-electric! '(c-mode c++-mode objc-mode java-mode) :chars '(?\n ?\} ?\{))
(set-formatter!
'clang-format
'("clang-format"
"-assume-filename"
(or (buffer-file-name)
(cdr (assoc major-mode
'((c-mode . ".c")
(c++-mode . ".cpp")
(cuda-mode . ".cu")
(protobuf-mode . ".proto"))))))
:modes '(c-mode c++-mode protobuf-mode cuda-mode))
(set-rotate-patterns! 'c++-mode
:symbols '(("public" "protected" "private")
("class" "struct")))

View file

@ -26,3 +26,7 @@
;; glslangValidator
(unless (executable-find "glslangValidator")
(warn! "Couldn't find glslangValidator. GLSL code completion is disabled")))
(when (modulep! :editor format)
(unless (executable-find "clang-format")
(warn! "Couldn't find clang-format. Formatting will be disabled.")))

View file

@ -47,6 +47,7 @@ This module requires:
- [[https://clojure-lsp.github.io/clojure-lsp/][clojure-lsp]], for LSP support (if [[doom-module:+lsp]])
- [[https://github.com/babashka/neil][neil]] for the ability to add packages to your Clojure project from Emacs
- [[https://github.com/borkdude/jet][jet]] for jet integration
- [[https://github.com/weavejester/cljfmt][cljfmt]], for formatting code (if [[doom-module::editor format]])
* Usage

View file

@ -16,6 +16,8 @@
(use-package! clojure-mode
:hook (clojure-mode . rainbow-delimiters-mode)
:config
(set-formatter! 'cljfmt '("cljfmt" "fix" "-") :modes '(clojure-mode clojurec-mode clojurescript-mode))
(when (modulep! +lsp)
(add-hook! '(clojure-mode-local-vars-hook
clojurec-mode-local-vars-hook

View file

@ -5,3 +5,7 @@
(not (modulep! +lsp)))
(unless (executable-find "clj-kondo")
(warn! "Couldn't find clj-kondo. flycheck-clj-kondo will not work.")))
(when (modulep! :editor format)
(unless (executable-find "cljfmt")
(warn! "Couldn't find cljfmt. Formatting will be disabled.")))

View file

@ -59,6 +59,12 @@ This module also enables the evaluation of =lisp= source blocks in Org Mode.
However, you will need a running Sly session for this to work. ~M-x sly~ starts
such a session if you didn't have one open already.
** formatter
By enabling [[doom-module::editor format]], [[fn:apheleia-indent-lisp-buffer]] will be
used to format the current buffer.
Enable [[doom-module::editor format +onsave]] to format the buffer on save.
* TODO Configuration
#+begin_quote
🔨 /This module's configuration documentation is incomplete./ [[doom-contrib-module:][Complete it?]]

View file

@ -26,10 +26,14 @@
(after! lisp-mode
(set-repl-handler! 'lisp-mode #'+lisp/open-repl)
(set-eval-handler! 'lisp-mode #'sly-eval-region)
(set-formatter! 'lisp-indent #'apheleia--indent-lisp-buffer :modes '(lisp-mode))
(set-lookup-handlers! 'lisp-mode
:definition #'sly-edit-definition
:documentation #'sly-describe-symbol))
;; This needs to be appended so it fires later than `sly-editing-mode'
(add-hook 'lisp-mode-local-vars-hook #'sly-lisp-indent-compatibility-mode 'append)
;; HACK Ensures that sly's contrib modules are loaded as soon as possible, but
;; also as late as possible, so users have an opportunity to override
;; `sly-contrib' in an `after!' block.

View file

@ -48,6 +48,12 @@ This module requires:
🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]
#+end_quote
** formatter
By enabling [[doom-module::editor format]], [[doom-package:apheleia]] will be
used to format the current buffer.
Enable [[doom-module::editor format +onsave]] to format the buffer on save.
* TODO Configuration
#+begin_quote
🔨 This module has no configuration documentation yet. [[doom-contrib-module:][Write some?]]

View file

@ -1,6 +1,8 @@
;;; lang/crystal/config.el -*- lexical-binding: t; -*-
(after! crystal-mode
(set-formatter! 'crystal-mode '("crystal" "tool" "format" "-") :modes '(crystal-mode))
(set-lookup-handlers! 'crystal-mode
:definition #'crystal-def-jump
:references #'crystal-tool-imp)

View file

@ -3,3 +3,6 @@
(unless (executable-find "icr")
(warn! "Couldn't find icr. REPL will not work"))
(unless (executable-find "crystal")
(error! "Couldn't find crystal. Most language features will not work."))

View file

@ -45,15 +45,22 @@ This module requires:
- .NET SDKs (on Windows)
- .NET Core 1.X - 3.X or .NET 5 for cross platform
- omnisharp-rosyln (if [[doom-module:+lsp]])
- [[doom-executable:csharpier]] (if [[doom-module::editor format]])
** TODO MacOS
** mono
*** TODO MacOS
** Arch Linux
*** Arch Linux
#+begin_src sh
pacman --needed --noconfirm -S mono
#+end_src
** TODO NixOS
*** TODO NixOS
** csharpier
#+begin_src shell
dotnet tool install csharpier -g
#+end_src
* TODO Usage
#+begin_quote

View file

@ -3,6 +3,7 @@
(use-package! csharp-mode
:hook (csharp-mode . rainbow-delimiters-mode)
:config
(set-formatter! 'csharpier '("dotnet-csharpier") :modes '(csharp-mode))
(set-electric! 'csharp-mode :chars '(?\n ?\}))
(set-rotate-patterns! 'csharp-mode
:symbols '(("public" "protected" "private")

View file

@ -9,3 +9,7 @@
(assert! (or (not (modulep! +tree-sitter))
(modulep! :tools tree-sitter))
"This module requires (:tools tree-sitter)")
(when (modulep! :editor format)
(unless (executable-find "dotnet-csharpier")
(warn! "csharpier is not installed, formatting will be disabled.")))

View file

@ -87,7 +87,7 @@ flutter doctor # for Dependency check and further instructions
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]]
#+end_quote
- Syntax highlighting and formatting for ~.dart~ files provided by LSP.
- Syntax highlighting and formatting for ~.dart~ files provided by LSP or [[doom-module::editor format]].
- Auto import.
- Widget guide lines for Flutter.
- Closing labels for constructors.

View file

@ -8,7 +8,8 @@
(setq nxml-slash-auto-complete-flag t
nxml-auto-insert-xml-declaration-flag t)
(set-company-backend! 'nxml-mode '(company-nxml company-yasnippet))
(setq-hook! 'nxml-mode-hook tab-width nxml-child-indent))
(setq-hook! 'nxml-mode-hook tab-width nxml-child-indent)
(set-formatter! 'xmllint '("xmllint" "--format" "-") :modes '(nxml-mode)))
;;;###package csv-mode

View file

@ -0,0 +1,5 @@
;;; lang/data/doctor.el -*- lexical-binding: t; -*-
(when (modulep! :editor format)
(unless (executable-find "xmllint")
(warn! "Couldn't find xmllint. Formatting will be disabled.")))

View file

@ -74,6 +74,7 @@ zypper install elixir
- Phoenix support
- ~iex~ integration ([[doom-module::tools eval]])
- Syntax checking ([[doom-module::checkers syntax]], using [[doom-package:flycheck-credo]])
- Formatting for elixir files provided by [[doom-module::editor format]].
** exunit-mode
The exunit-mode prefix is [[kbd:][<localleader> t]]. Here is some examples:

View file

@ -43,6 +43,12 @@ This module adds [[https://elm-lang.org/][Elm]] support to Doom Emacs.
🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]
#+end_quote
** formatter
By enabling [[doom-module::editor format]], [[doom-package:apheleia]] will be
used to format the current buffer.
Enable [[doom-module::editor format +onsave]] to format the buffer on save.
* TODO Configuration
#+begin_quote
🔨 This module has no configuration documentation yet. [[doom-contrib-module:][Write some?]]

View file

@ -56,6 +56,12 @@ about it.
🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]
#+end_quote
** formatter
By enabling [[doom-module::editor format]], [[doom-package:apheleia]] will be
used to format the current buffer.
Enable [[doom-module::editor format +onsave]] to format the buffer on save.
* TODO Configuration
#+begin_quote
🔨 This module has no configuration documentation yet. [[doom-contrib-module:][Write some?]]

View file

@ -39,6 +39,7 @@ See `+emacs-lisp-non-package-mode' for details.")
:documentation #'+emacs-lisp-lookup-documentation)
(set-docsets! '(emacs-lisp-mode lisp-interaction-mode) "Emacs Lisp")
(set-ligatures! 'emacs-lisp-mode :lambda "lambda")
(set-formatter! 'lisp-indent #'apheleia--indent-lisp-buffer :modes '(emacs-lisp-mode))
(set-rotate-patterns! 'emacs-lisp-mode
:symbols '(("t" "nil")
("let" "let*")

View file

@ -39,13 +39,20 @@ Includes:
This module requires Erlang be installed (which includes ~erlang-mode~). Check
your distribution's package manager or a version management tool such as [[https://github.com/kerl/kerl][kerl]].
For LSP support, install [[https://github.com/erlang/sourcer][sourcer]].
- [[https://github.com/erlang/sourcer][sourcer]] when [[doom-module::tools lsp]] & [[doom-module:+lsp]]
- [[https://github.com/sile/efmt][efmt]] when [[doom-module::editor format]]
* TODO Usage
#+begin_quote
🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]
#+end_quote
** formatter
By enabling [[doom-module::editor format]], [[doom-package:apheleia]] will be
used to format the current buffer.
Enable [[doom-module::editor format +onsave]] to format the buffer on save.
* TODO Configuration
#+begin_quote
🔨 This module has no configuration documentation yet. [[doom-contrib-module:][Write some?]]

View file

@ -5,6 +5,7 @@
:mode ("/rebar\\.config\\(?:\\.script\\)?\\'" . erlang-mode)
:mode ("/\\(?:app\\|sys\\)\\.config\\'" . erlang-mode)
:config
(set-formatter! 'efmt '("efmt" "-") :modes '(erlang-mode))
(when (modulep! +lsp)
(add-hook 'erlang-mode-local-vars-hook #'lsp! 'append))

View file

@ -4,3 +4,7 @@
(assert! (or (not (modulep! +lsp))
(modulep! :tools lsp))
"This module requires (:tools lsp)")
(when (modulep! :editor format)
(unless (executable-find "efmt")
(warn! "Couldn't find efmt. Formatting will be disabled.")))

View file

@ -97,6 +97,11 @@ your Bash Profile, etc., and log out and in again._ Now Doom will be able to use
Good luck and happy computing!
** efmt
When [[doom-module::editor format]] is enabled and [[doom-executable:fprettify]] is installed, buffers can be formatted with [[fn:apheleia-format-buffer]].
Enable [[doom-module::editor format +onsave]] to format the buffer on save.
* TODO Usage
#+begin_quote
🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]

View file

@ -35,6 +35,8 @@
:desc "build" "b" #'+fortran/build
:desc "run" "r" #'+fortran/run)
(set-formatter! 'fprettify '("fprettify" "-") :modes '(f90-mode fortran-mode))
(when (modulep! +intel)
(map! :map f90-mode-map
:localleader

View file

@ -18,6 +18,8 @@
(when (modulep! +lsp)
(unless (executable-find "fortls")
(warn! "Couldn't find fortls."))
(warn! "Couldn't find fortls. Language features will be disabled.")))
(when (modulep! :editor format)
(unless (executable-find "fprettify")
(warn! "Couldn't find fprettify.")))
(warn! "Couldn't find fprettify. Formatting will be disabled.")))

View file

@ -48,6 +48,13 @@ pacman -S mono
** LSP
The language server is automatically installed by [[https://github.com/emacs-lsp/lsp-mode/blob/master/clients/lsp-fsharp.el][lsp-fsharp]].
** Fantomas
Fantomas is used for formatting via [[doom-module::editor format]] and can be installed as a [[https://dotnet.microsoft.com/en-us/download][dotnet]] tool.
#+begin_src shell
dotnet tool install -g fantomas-tool
#+end_src
* TODO Usage
#+begin_quote
🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]

View file

@ -11,6 +11,7 @@
(set-lookup-handlers! 'fsharp-mode :async t :definition #'fsharp-ac/gotodefn-at-point)
(set-company-backend! 'fsharp-mode 'fsharp-ac/company-backend))
(set-repl-handler! 'fsharp-mode #'run-fsharp)
(set-formatter! 'fantomas '("fantomas" "--stdin") :modes '(fsharp-mode))
(map! :localleader
:map fsharp-mode-map
"b" #'fsharp-ac/pop-gotodefn-stack ; Useful for re-tracing your steps

View file

@ -13,6 +13,8 @@
(set-lookup-handlers! 'gdscript-mode
:documentation #'gdscript-docs-browse-symbol-at-point)
(set-formatter! 'gdformat '("gdformat" "-") :modes '(gdscript-mode))
(when (modulep! +lsp)
(add-hook 'gdscript-mode-local-vars-hook #'lsp! 'append))

View file

@ -0,0 +1,5 @@
;;; lang/gdscript/doctor.el -*- lexical-binding: t; -*-
(when (modulep! :editor format)
(unless (executable-find "gdformat")
(warn! "Couldn't find gdformat. Formatting will be disabled.")))

View file

@ -11,14 +11,6 @@
:references #'go-guru-referrers
:documentation #'godoc-at-point)
;; Redefines default formatter to *not* use goimports if reformatting a
;; region; as it doesn't play well with partial code.
(set-formatter! 'gofmt
'(("%s" (if (or +format-region-p
(not (executable-find "goimports")))
"gofmt"
"goimports"))))
(if (modulep! +lsp)
(add-hook 'go-mode-local-vars-hook #'lsp! 'append)
(add-hook 'go-mode-hook #'go-eldoc-setup))

View file

@ -43,9 +43,15 @@ It includes:
* Installation
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
** LSP
This module has no direct requirements, but the +lsp flag requires a [[https://emacs-lsp.github.io/lsp-mode/page/lsp-graphql/][supported
LSP server]].
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://prettier.io/docs/en/install.html][prettier]].
* Usage
** Sending queries
When visiting a graphql buffer, you have access to the ability to send the

View file

@ -52,6 +52,11 @@ system package manager, cabal, or stack.
formatters such as [[https://github.com/lspitzner/brittany][brittany]], [[https://github.com/ennocramer/floskell][floskell]], [[https://github.com/tweag/ormolu][ormolu]], [[https://github.com/fourmolu/fourmolu][fourmolu]], and [[https://github.com/haskell/stylish-haskell][stylish-haskell]],
which can be installed through system package manager, cabal, or stack.
** Formatter
[[doom-module::editor format]] by default uses [[https://github.com/fourmolu/fourmolu#installation][fourmolu]] to format code when not
relying on hls, follow the linked install instructions.
* TODO Usage
#+begin_quote
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]]
@ -61,12 +66,12 @@ This module integrates the haskell packages into Doom by providing things such
as REPL support, project root recognition, etc. It also provide the following
keybindings:
| Keybinding | Description |
|-----------------+-----------------------------------------------|
| [[kbd:][<localleader> b]] | Build the current cabal project |
| Keybinding | Description |
|-----------------+---------------------------------------------|
| [[kbd:][<localleader> b]] | Build the current cabal project |
| [[kbd:][<localleader> c]] | Visit the =.cabal= file of the current buffer |
| [[kbd:][<localleader> h]] | Toggle visibility of the form at point |
| [[kbd:][<localleader> H]] | hides all top level functions |
| [[kbd:][<localleader> h]] | Toggle visibility of the form at point |
| [[kbd:][<localleader> H]] | hides all top level functions |
* TODO Configuration
#+begin_quote

View file

@ -5,4 +5,5 @@
:interpreter "hy"
:config
(set-repl-handler! 'hy-mode #'hy-shell-start-or-switch-to-shell)
(set-formatter! 'lisp-indent #'apheleia--indent-lisp-buffer :modes '(hy-mode))
(set-company-backend! 'hy-mode 'company-hy))

View file

@ -98,6 +98,18 @@ JAVA_HOME=~/.jabba/jdk/adopt@1.11.0-3
And then run ~$ direnv allow .~ in the project directory. The [[doom-module::tools direnv]]
module will automatically source this environment before activating LSP servers.
** Formatter
[[doom-module::editor format]] uses [[https://github.com/google/google-java-format][google-java-format]] to handle formatting.
To install, grab the latest =all-deps.jar= release from the above, put it
somewhere and create a script similar to the below:
=/usr/local/bin/google-java-format=
#+begin_src shell
java -jar /path/to/google-java-format-all-deps.jar
#+end_src
* TODO Usage
#+begin_quote
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]]

View file

@ -58,6 +58,10 @@ This module requires [[https://nodejs.org/en/][NodeJS]] and one of [[https://www
- Arch Linux: ~$ pacman --needed --noconfirm -S nodejs npm~
- openSUSE: ~$ zypper install nodejs npm~
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://prettier.io/docs/en/install.html][prettier]].
* TODO Usage
#+begin_quote
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]]

View file

@ -32,7 +32,9 @@ This module adds [[https://www.json.org/json-en.html][JSON]] support to Doom Ema
* Installation
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
/This module has no external requirements./
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://prettier.io/docs/en/install.html][prettier]].
* TODO Usage
#+begin_quote

View file

@ -25,12 +25,22 @@ This module adds [[https://kotlinlang.org/][Kotlin]] support to Doom Emacs.
# This section will be machine generated. Don't edit it by hand.
/This module does not have a changelog yet./
* TODO Installation
* Installation
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
#+begin_quote
🔨 /This module's prerequisites are not documented./ [[doom-contrib-module:][Document them?]]
#+end_quote
Install kotlin through your distribution's package manager, eg:
#+begin_src shell
sudo apt install kotlin # Ubuntu
sudo pacman -S kotlin # Arch Linux
brew install kotlin # MacOS
#+end_src
or by getting the [[https://github.com/JetBrains/kotlin/releases/latest][latest]] release and adding to your =$PATH= manually.
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://pinterest.github.io/ktlint/install/cli/][ktlint]].
* TODO Usage
#+begin_quote

View file

@ -93,6 +93,10 @@ brew install --cask mactex # WARNING: large 4gb download!
environment.systemPackages = [ pkgs.texlive.combined.scheme-medium ];
#+end_src
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://github.com/cmhughes/latexindent.pl][latexindent]].
* TODO Usage
#+begin_quote
🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]

View file

@ -75,6 +75,10 @@ Eglot currently only supports one of the above servers out of the box:
=$EMACSDIR/.local/etc/lsp/lua-language-server/=. See ~+lua-lsp-dir~ variable
to change this.
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://github.com/JohnnyMorganz/StyLua#installation][Stylua]].
* TODO Usage
#+begin_quote
🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]

View file

@ -115,6 +115,10 @@ installed through your OS's package manager:
+ MacOS: ~$ brew install multimarkdown~
+ Arch Linux: [[https://aur.archlinux.org/packages/multimarkdown/][multimarkdown]] is available on the AUR
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://prettier.io/docs/en/install.html][prettier]].
* TODO Usage
#+begin_quote
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]]

View file

@ -51,6 +51,10 @@ Alternatively, nim is usually available through your OS's package manager:
- Arch Linux: ~$ pacman --needed --noconfirm -S nim nimble~
- openSUSE: ~$ zypper install nim~
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://github.com/FedericoCeratto/nimfmt#installation][nimfmt]].
* TODO Usage
#+begin_quote
🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]

View file

@ -12,6 +12,8 @@ nimsuggest isn't installed."
(when (and nimsuggest-path (file-executable-p nimsuggest-path))
(nimsuggest-mode))))
(set-formatter! 'nmfmt '("nimfmt" filepath) :modes '(nim-mode))
(when IS-WINDOWS
;; TODO File PR/report upstream (https://github.com/nim-lang/nim-mode)
(defadvice! +nim--suggest-get-temp-file-name-a (path)

View file

@ -1,4 +1,4 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/nim/doctor.el
(unless (executable-find "nimsuggest")
@ -7,3 +7,6 @@
(unless (executable-find "nim")
(warn! "Could not find nim executable; build commands will be disabled."))
(when (modulep! :editor format)
(unless (executable-find "nimfmt")
(warn! "Could not find nimfmt. Formatting will be disabled.")))

View file

@ -107,8 +107,6 @@
:commands ocamlformat
:hook (tuareg-mode-local-vars . +ocaml-init-ocamlformat-h)
:config
(set-formatter! 'ocamlformat #'ocamlformat
:modes '(caml-mode tuareg-mode))
;; TODO Fix region-based formatting support
(defun +ocaml-init-ocamlformat-h ()
(setq +format-with 'ocp-indent)

View file

@ -30,7 +30,6 @@
(set-docsets! 'php-mode "PHP" "PHPUnit" "Laravel" "CakePHP" "CodeIgniter" "Doctrine_ORM")
(set-repl-handler! 'php-mode #'+php/open-repl)
(set-lookup-handlers! 'php-mode :documentation #'php-search-documentation)
(set-formatter! 'php-mode #'php-cs-fixer-fix)
(set-ligatures! 'php-mode
;; Functional
:lambda "function()" :lambda "fn"

View file

@ -26,12 +26,20 @@ This module adds [[https://www.purescript.org/][Purescript]] support to Doom Ema
# This section will be machine generated. Don't edit it by hand.
/This module does not have a changelog yet./
* TODO Installation
* Installation
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
#+begin_quote
🔨 /This module's prerequisites are not documented./ [[doom-contrib-module:][Document them?]]
#+end_quote
The main tools for PureScript are installed via npm.
** Compiler
#+begin_src shell
npm install -g purescript spago
#+end_src
** Formatter
#+begin_src sh
npm install -g purs-tidy
#+end_src
* TODO Usage
#+begin_quote

View file

@ -8,6 +8,8 @@
#'purescript-indentation-mode
#'rainbow-delimiters-mode)
(set-formatter! 'purs-tidy '("purs-tidy" "format") :modes '(purescript-mode))
(map! :localleader
:map purescript-mode-map
"t" #'psc-ide-show-type

View file

@ -0,0 +1,5 @@
;;; lang/purescript/doctor.el -*- lexical-binding: t; -*-
(when (modulep! :editor format)
(unless (executable-find "purs-tidy")
(warn! "Could not find purs-tidy. Formatting will be disabled.")))

View file

@ -92,6 +92,10 @@ An alternative LSP server can be used by installing them through the
- To install *mspyls*: ~M-x lsp-install-server RET mspyls~.
- To install *pyright*: ~$ pip install pyright~ or ~$ npm i -g pyright~.
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://black.readthedocs.io/en/stable/getting_started.html#installation][black]].
* TODO Usage
#+begin_quote
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]]

View file

@ -43,6 +43,10 @@ Or, for fewer dependencies:
pacman -S racket-minimal
#+end_src
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://docs.racket-lang.org/fmt/][fmt]].
* TODO Usage
#+begin_quote
🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]

View file

@ -21,6 +21,7 @@
:dot ".")
(set-rotate-patterns! 'racket-mode
:symbols '(("#true" "#false")))
(set-formatter! 'raco-fmt '("raco" "fmt") :modes '(racket-mode))
(add-hook! 'racket-mode-hook
#'rainbow-delimiters-mode

View file

@ -9,3 +9,8 @@
(unless (executable-find "raco")
(warn! "Could not find raco executable; commands for install packages and build libraries will not work."))
(when (modulep! :editor format)
(unless (and (executable-find "raco")
(eq 0 (call-process-shell-command "raco fmt --help" nil nil)))
(warn! "Couldn't find raco fmt. Formatting will be disabled.")))

View file

@ -27,6 +27,10 @@ This module adds [[https://docutils.sourceforge.io/rst.html][ReStructured Text]]
This module requires [[https://www.sphinx-doc.org/en/master/usage/installation.html][sphinx]] to build RST documents.
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://github.com/dzhu/rstfmt#usage][rstfmt]].
* TODO Usage
#+begin_quote
🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]

View file

@ -1,7 +1,9 @@
;;; lang/rst/config.el -*- lexical-binding: t; -*-
(use-package! sphinx-mode
:hook (rst-mode . sphinx-mode))
:hook (rst-mode . sphinx-mode)
:config
(set-formatter! 'rstfmt '("rstfmt") :modes '(rst-mode)))
(use-package! rst
:defer t

View file

@ -0,0 +1,5 @@
;;; lang/rst/doctor.el -*- lexical-binding: t; -*-
(when (modulep! :editor format)
(unless (executable-find "rstfmt")
(warn! "Couldn't find rstfmt. Formatting will be disabled.")))

View file

@ -70,6 +70,10 @@ These guides will help you install Ruby:
Then run ~$ gem install rubocop~ to install rubocop.
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://prettier.io/docs/en/install.html][prettier]].
* TODO Usage
#+begin_quote
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]]

View file

@ -64,7 +64,7 @@ To install and manage Rust on Windows, consult [[https://forge.rust-lang.org/inf
** Other Requirements
- If [[doom-module::editor format]] is enabled, you'll need =rustfmt=: ~$ rustup component add
rustfmt-preview~.
rustfmt~.
- Users with [[doom-module:+lsp]] enabled will need [[github:rust-analyzer/rust-analyzer][rust-analyzer]] (rls is supported,
but [[https://blog.rust-lang.org/2022/07/01/RLS-deprecation.html][deprecated]]).
- Using the following commands requires:

View file

@ -95,6 +95,10 @@ coursier bootstrap \
yay -S metals
#+end_src
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://scalameta.org/scalafmt/docs/installation.html#cli][scalafmt]].
* TODO Usage
#+begin_quote
🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]

View file

@ -22,6 +22,8 @@
(when (modulep! +tree-sitter)
(add-hook 'scala-mode-local-vars-hook #'tree-sitter! 'append))
(set-formatter! 'scalafmt '("scalafmt" "--stdin") :modes '(scala-mode))
(set-ligatures! 'scala-mode
;; Functional
:def "def"

View file

@ -11,3 +11,7 @@
(if (and (modulep! +lsp)
(not (executable-find "metals")))
(warn! "metals isn't installed"))
(when (modulep! :editor format)
(unless (executable-find "scalafmt")
(warn! "Couldn't find scalafmt. Formatting will be disabled.")))

View file

@ -3,7 +3,9 @@
(use-package! scheme
:interpreter ("scsh" . scheme-mode)
:hook (scheme-mode . rainbow-delimiters-mode)
:config (advice-add #'scheme-indent-function :override #'+scheme-indent-function-a))
:config
(set-formatter! 'lisp-indent #'apheleia--indent-lisp-buffer :modes '(scheme-mode))
(advice-add #'scheme-indent-function :override #'+scheme-indent-function-a))
(use-package! geiser

View file

@ -49,6 +49,8 @@ This module has several optional dependencies:
- With the [[doom-module::tools debugger]] module
- [[http://bashdb.sourceforge.net/][bashdb]]: Enables debugging for bash scripts
- [[https://github.com/rocky/zshdb][zshdb]]: Enables debugging for zsh scripts
- With the [[doom-module::editor format]] module
- [[https://github.com/patrickvane/shfmt][shfmt]]: Enables formatting for {posix,ba,mk}sh scripts
* TODO Usage
#+begin_quote

View file

@ -17,10 +17,10 @@
:config
(set-docsets! 'sh-mode "Bash")
(set-electric! 'sh-mode :words '("else" "elif" "fi" "done" "then" "do" "esac" ";;"))
(set-formatter! 'shfmt
'("shfmt" "-ci"
("-i" "%d" (unless indent-tabs-mode tab-width))
("-ln" "%s" (pcase sh-shell (`bash "bash") (`mksh "mksh") (_ "posix")))))
(set-formatter! 'shfmt '("shfmt" "-ci"
(unless indent-tabs-mode
(list "-i" (number-to-string tab-width)))))
(set-repl-handler! 'sh-mode #'+sh/open-repl)
(set-lookup-handlers! 'sh-mode :documentation #'+sh-lookup-documentation-handler)
(set-ligatures! 'sh-mode
@ -85,10 +85,6 @@
;; whatis lookups are exceptionally slow on macOS (#5860)
company-shell-dont-fetch-meta IS-MAC))
(use-package! fish-mode
:when (modulep! +fish)
:defer t
:config (set-formatter! 'fish-mode #'fish_indent))
(use-package! powershell
:when (modulep! +powershell)

View file

@ -28,6 +28,10 @@ THis module adds [[https://smlfamily.github.io/][SML (Standard ML) programming l
This module requires =sml= and =MLton=.
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://github.com/jluningp/smlformat#installation][smlformat]].
* TODO Usage
#+begin_quote
🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]

View file

@ -4,6 +4,7 @@
:mode "\\.s\\(?:ml\\|ig\\)\\'"
:config
(set-repl-handler! 'sml-mode #'run-sml)
(set-formatter! 'smlformat '("smlformat") :modes '(sml-mode))
;; don't auto-close apostrophes (type 'a = foo) and backticks (`Foo)
(sp-with-modes 'sml-mode

View file

@ -0,0 +1,5 @@
;;; lang/sml/doctor.el -*- lexical-binding: t; -*-
(when (modulep! :editor format)
(unless (executable-find "smlformat")
(warn! "Couldn't find smlformat. Formatting will be disabled.")))

View file

@ -55,6 +55,10 @@ can set it to your own =.soliumrc.json= with:
(setq flycheck-solidity-solium-soliumrcfile "~/.soliumrc.json")
#+end_src
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://github.com/prettier-solidity/prettier-plugin-solidity#installation-and-usage][prettier]].
* TODO Usage
#+begin_quote
🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]

View file

@ -7,6 +7,7 @@
(setq solidity-comment-style 'slash)
(set-docsets! 'solidity-mode "Solidity")
(set-company-backend! 'solidity-mode 'company-solidity)
(set-formatter! 'prettier-solidity '(npx "prettier" "--stdin-filepath" filepath "--parser=solidity") :modes '(solidity-mode))
(use-package! solidity-flycheck ; included with solidity-mode
:when (and (modulep! :checkers syntax)

View file

@ -35,6 +35,10 @@ This module adds support for the [[https://developer.apple.com/swift/][Swift pro
* TODO Installation
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://github.com/nicklockwood/SwiftFormat#command-line-tool][swiftformat]].
#+begin_quote
🔨 /This module's prerequisites are not documented./ [[doom-contrib-module:][Document them?]]
#+end_quote

View file

@ -27,6 +27,7 @@
:after swift-mode
:init (add-hook 'swift-mode-local-vars-hook #'lsp! 'append)
:config
(set-formatter! 'swiftformat '("swiftformat" "--output" "stdout"))
(setq lsp-sourcekit-executable
(cl-find-if #'executable-find
(list lsp-sourcekit-executable ; 'sourcekit-lsp' by default

View file

@ -3,3 +3,7 @@
(assert! (or (not (modulep! +tree-sitter))
(modulep! :tools tree-sitter))
"This module requires (:tools tree-sitter)")
(when (modulep! :editor format)
(unless (executable-find "swiftformat")
(warn! "Couldn't find swiftformat. Formatting will be disabled.")))

View file

@ -27,15 +27,15 @@
;; tidy is already defined by the format-all package. We redefine it to add
;; more sensible arguments to the tidy command.
(set-formatter! 'html-tidy
'("tidy" "-q" "-indent"
"--tidy-mark" "no"
"--drop-empty-elements" "no"
("--show-body-only" "%s" (if +format-region-p "true" "auto"))
("--indent-spaces" "%d" tab-width)
("--indent-with-tabs" "%s" (if indent-tabs-mode "yes" "no"))
("-xml" (memq major-mode '(nxml-mode xml-mode))))
:ok-statuses '(0 1))
;; (set-formatter! 'html-tidy
;; '("tidy" "-q" "-indent"
;; "--tidy-mark" "no"
;; "--drop-empty-elements" "no"
;; ("--show-body-only" "%s" (if +format-region-p "true" "auto"))
;; ("--indent-spaces" "%d" tab-width)
;; ("--indent-with-tabs" "%s" (if indent-tabs-mode "yes" "no"))
;; ("-xml" (memq major-mode '(nxml-mode xml-mode))))
;; :ok-statuses '(0 1))
(setq web-mode-enable-html-entities-fontification t
web-mode-auto-close-style 1)

View file

@ -48,6 +48,10 @@ ReactJS, Wordpress, Jekyll, Phaser, AngularJS, Djano, and more.
* TODO Installation
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://prettier.io/docs/en/install.html][prettier]].
#+begin_quote
🔨 /No installation steps have been documented./ [[doom-contrib-module:][Document them?]]
#+end_quote

View file

@ -30,7 +30,9 @@ This module provides support for the [[https://yaml.org/][YAML file format]] to
* Installation
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
/This module has no external requirements./
** Formatter
Formatting is handled using the [[doom-module::editor format]] module via [[https://prettier.io/docs/en/install.html][prettier]].
* TODO Usage
#+begin_quote

View file

@ -11,6 +11,7 @@
:hook (zig-mode . rainbow-delimiters-mode)
:config
(setq zig-format-on-save nil) ; rely on :editor format instead
(set-formatter! 'zigfmt '("zig" "fmt" "--stdin") :modes '(zig-mode))
(when (modulep! +lsp)
(add-hook 'zig-mode-local-vars-hook #'lsp! 'append))

View file

@ -10,7 +10,10 @@
"This module requires (:tools tree-sitter)")
(unless (executable-find "zig")
(warn! "Couldn't find zig binary"))
(warn! "Couldn't find zig binary")
(unless (modulep! :editor format)
(warn! "Formatting will be disabled")))
(when (modulep! +lsp)
(unless (executable-find "zls")