Skip to content
YAML support for lsp-mode
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.gitignore
Cask
README.md
lsp-yaml-tests.el
lsp-yaml.el
run-tests.sh

README.md

lsp-yaml

CircleCI Coverage Status

YAML support for lsp-mode using yaml-language-server.

Setup

Prerequisite

Install yaml-language-server (>= v0.4.0) by npm.

$ npm install -g yaml-language-server

Dependency

Configuration

To enable lsp-yaml in yaml-mode buffer, with use-package,

(use-package lsp-yaml
  :after lsp
  :config
  (add-hook 'yaml-mode-hook #'lsp))

Customization

lsp-yaml-format-enable

Specify whether to enable YAML format feature.

Default is nil.

lsp-yaml-format-options

Specify YAML format options as plist, alist or hash table. Specified options are converted to JSON object under yaml.format and sent to the server as is.

For example,

(:singleQuote t :bracketSpacing :json-false :proseWrap "preserve")

will be sent as

{
  "yaml": {
    "format": {
      "singleQuote": true,
      "bracketSpacing": false,
      "proseWrap": "preserve"
    }
  }
}

Refer to Language Server Settings of yaml-language-server for the detail.

Default is nil.

lsp-yaml-language-server-dir

Directory where yaml-language-server is installed.

Default is yaml-language-server installed under global NPM prefix directory.

lsp-yaml-schemas

Schemas plist or alist that associates schema with glob patterns. This can be also a hash table.

For example,

(setq lsp-yaml-schemas '(:kubernetes "/*-k8s.yaml"))

Default is nil.

lsp-yaml-validate

Specify whether to enable YAML validation feature.

Default is t.

lsp-yaml-hover

Specify whether to enable hover feature.

Default is t.

lsp-yaml-completion

Specify whether to enable YAML autocompletion feature.

Default is t.

You can’t perform that action at this time.