#+TITLE: YAML layer

#+TAGS: dsl|layer|markup|programming

* Table of Contents                     :TOC_5_gh:noexport:
- [[#description][Description]]
  - [[#features][Features:]]
- [[#install][Install]]
  - [[#layer][Layer]]
  - [[#lsp][LSP]]
- [[#syntax-checking-with-flycheck][Syntax checking with flycheck]]

* Description
This layer provides support for the YAML file format.

** Features:
- Syntax highlighting
- Syntax checking via [[http://www.flycheck.org/en/latest/languages.html#yaml][flycheck]]

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

** LSP
To enable LSP, install [[https://github.com/redhat-developer/yaml-language-server][yaml-language-server]]:

#+BEGIN_SRC sh
  npm i -g yaml-language-server
#+END_SRC

And set the layer variable =yaml-enable-lsp= to =t= like shown below:

#+BEGIN_SRC emacs-lisp
  (setq-default dotspacemacs-configuration-layers
                '((yaml :variables yaml-enable-lsp t)))
#+END_SRC

* Syntax checking with flycheck
Flycheck checks YAML files with either:
- =yaml-yamllint= (requires =yamllint=)
- =yaml-jsyaml= (requires the =node-js= package =js-yaml=)
- or =yaml-ruby= (requires that =ruby= is installed on your system)

The flycheck YAML documentation can be found at the [[http://www.flycheck.org/en/latest/languages.html#yaml][flycheck website]].
