2021-07-15 00:50:07 +02:00
|
|
|
local M = {}
|
|
|
|
|
|
|
|
M.config = function()
|
2021-07-15 03:14:25 +02:00
|
|
|
O.lang.yaml = {
|
|
|
|
formatter = {
|
|
|
|
exe = "prettier",
|
|
|
|
args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" },
|
|
|
|
},
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
M.format = function()
|
2021-07-15 02:48:05 +02:00
|
|
|
O.formatters.filetype["yaml"] = {
|
|
|
|
function()
|
|
|
|
return {
|
|
|
|
exe = O.lang.yaml.formatter.exe,
|
|
|
|
args = O.lang.yaml.formatter.args,
|
|
|
|
stdin = not (O.lang.yaml.formatter.stdin ~= nil),
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
require("formatter.config").set_defaults {
|
|
|
|
logging = false,
|
|
|
|
filetype = O.formatters.filetype,
|
|
|
|
}
|
2021-07-15 00:50:07 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
M.lint = function()
|
|
|
|
-- TODO: implement linters (if applicable)
|
|
|
|
return "No linters configured!"
|
|
|
|
end
|
|
|
|
|
2021-07-15 02:48:05 +02:00
|
|
|
M.lsp = function()
|
|
|
|
if require("lv-utils").check_lsp_client_active "yamlls" then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
-- npm install -g yaml-language-server
|
|
|
|
require("lspconfig").yamlls.setup {
|
|
|
|
cmd = { DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server", "--stdio" },
|
|
|
|
on_attach = require("lsp").common_on_attach,
|
|
|
|
}
|
|
|
|
end
|
2021-07-15 00:50:07 +02:00
|
|
|
|
|
|
|
M.dap = function()
|
|
|
|
-- TODO: implement dap
|
|
|
|
return "No DAP configured!"
|
|
|
|
end
|
|
|
|
|
|
|
|
return M
|