From 6ea652ba5e0d066cb1abdadeb66e0a8c638a4816 Mon Sep 17 00:00:00 2001 From: Luiz Correia Date: Fri, 19 Nov 2021 22:09:40 -0300 Subject: feat: add spectral-language-server support (#1455) --- lua/lspconfig/spectral.lua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lua/lspconfig/spectral.lua (limited to 'lua') diff --git a/lua/lspconfig/spectral.lua b/lua/lspconfig/spectral.lua new file mode 100644 index 00000000..661cb9b1 --- /dev/null +++ b/lua/lspconfig/spectral.lua @@ -0,0 +1,32 @@ +local configs = require 'lspconfig/configs' +local util = require 'lspconfig/util' + +local server_name = 'spectral_ls' +local bin_name = 'spectral-language-server' + +configs[server_name] = { + default_config = { + cmd = { bin_name, '--stdio' }, + filetypes = { 'yaml', 'json', 'yml' }, + root_dir = util.root_pattern('.spectral.yaml', '.spectral.yml'), + single_file_support = true, + settings = { + enable = true, + run = 'onType', + validateLanguages = { 'yaml', 'json', 'yml' }, + }, + }, + docs = { + package_json = 'https://raw.githubusercontent.com/stoplightio/vscode-spectral/master/package.json', + description = [[ +https://github.com/luizcorreia/spectral-language-server + `A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v2 & v3.` + +`spectral-language-server` can be installed via `npm`: +```sh +npm i -g spectral-language-server +``` +See [vscode-spectral](https://github.com/stoplightio/vscode-spectral#extension-settings) for configuration options. +]], + }, +} -- cgit v1.2.3-70-g09d2