1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
local M = {}
M.config = function()
O.lang.yaml = {
formatter = {
exe = "prettier",
args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" },
stdin = true,
},
lsp = {
path = DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server",
},
}
end
M.format = function()
O.formatters.filetype["yaml"] = {
function()
return {
exe = O.lang.yaml.formatter.exe,
args = O.lang.yaml.formatter.args,
stdin = O.lang.yaml.formatter.stdin,
}
end,
}
require("formatter.config").set_defaults {
logging = false,
filetype = O.formatters.filetype,
}
end
M.lint = function()
-- TODO: implement linters (if applicable)
return "No linters configured!"
end
M.lsp = function()
if require("utils").check_lsp_client_active "yamlls" then
return
end
-- npm install -g yaml-language-server
require("lspconfig").yamlls.setup {
cmd = { O.lang.yaml.lsp.path, "--stdio" },
on_attach = require("lsp").common_on_attach,
}
end
M.dap = function()
-- TODO: implement dap
return "No DAP configured!"
end
return M
|