spacemacs/layers/+lang/reasonml
syl20bnr 584392bd92 [core] Fix layer dependencies based on layer variables
There was a edge case with the declaration of the `lsp` layer in `layers.el`
files.
The `hy` layer depends on the `python` layer which in turn depends on the `lsp`
layer if and only if the `python-backend` layer variable is set to `lsp`.
When the `hy` layer was declared first then it declares the `python` layer
without its layer variables, thus the `lsp` layer was not declared because the
`python-backend` variable was not set.

The fix is to gather all the layer dependencies and resolve them only after all
the used layers have been declared.

* new function `configuration-layer/declare-layer-dependencies`
* replace all calls to `configuration-layer/declare-layer` by the new function
  except for distribution layers (we declare layer dependencies right away in
  distribution layers)
2019-09-30 02:00:48 -04:00
..
config.el Add reasonml layer 2019-06-25 12:03:36 +02:00
funcs.el Add reasonml layer 2019-06-25 12:03:36 +02:00
layers.el [core] Fix layer dependencies based on layer variables 2019-09-30 02:00:48 -04:00
packages.el Add reasonml layer 2019-06-25 12:03:36 +02:00
README.org update .org tags 2019-07-03 11:32:58 +03:00

ReasonML layer

https://reasonml.github.io/img/reason.svg

Description

Spacemacs layer for ReasonML, based around reason-mode.

Features:

  • Syntax highlighting / indentation
  • Autocomplete (via merlin)
  • Lint / error display (via merlin, and flycheck if syntax-checking layer is enabled)
  • REPL via rtop
  • Auto-formatting (via refmt)

Install

To use this configuration layer, add it to your ~/.spacemacs. You will need to add reasonml to the existing dotspacemacs-configuration-layers list in this file.

This layer depends on the `ocaml` layer which should be installed automatically.

Merlin

You'll need merlin (binaries ocamlmerlin and ocamlmerlin-reason) installed on your system and on your PATH for errors and auto-completion.

If you're familiar with opam you can

  opam install merlin reason

to get ocamlmerlin and ocamlmerlin-reason on your current opam switch.

Refmt

Similarly to Merlin, you'll need the refmt binary on your path.

If you're familiar with opam you can

  opam install reason

to get refmt in your current opam switch.

If your project depends on a specific version of refmt, you can set refmt-command (via customize-mode or (setq refmt-command ..)) to the path to a particular binary. You can also use the special values 'npm or 'opam to run refmt via npx or opam exec, which will keep you on the correct version for your current opam switch, or the project-local of node_modules.

You can toggle refmt on save with SPC m r t. To permanently enable it, add the layer variable:

  (reasonml :variables reason-auto-refmt t)

in your dotspacemacs-configuration-layers.

Key bindings

The main key bindings, see packages.el for the main list.

Key binding Description
SPC m g g Jump to definition
SPC m g G Jump to definition (other window)
SPC m g b Jump back
SPC m h t Show type
SPC m h h Show docs
SPC m r d Merlin destruct
SPC m = = Refmt
SPC m t r Toggle auto-refmt on save
SPC m = m r Refmt: convert ml syntax to re syntax
SPC m = r m Refmt: convert re syntax to ml syntax

Thanks

Special thanks to fredyr who wrote the initial verison of this layer.