1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2025-07-01 19:49:25 +00:00

[neovim] Fix yaml-companion

This commit is contained in:
2023-11-03 18:48:15 +01:00
parent d5c9273e44
commit fb9748c38d
4 changed files with 47 additions and 42 deletions

View File

@ -33,18 +33,20 @@ require("mason-lspconfig").setup({
local lspconfig = require("lspconfig")
for _, server in pairs(servers) do
local opts = {
on_attach = require("plugins.lsp.handlers").on_attach,
capabilities = require("plugins.lsp.handlers").capabilities,
}
if server ~= "yamlls" then
local opts = {
on_attach = require("plugins.lsp.handlers").on_attach,
capabilities = require("plugins.lsp.handlers").capabilities,
}
server = vim.split(server, "@")[1]
server = vim.split(server, "@")[1]
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
local config_exists, conf_opts = pcall(require, "plugins.lsp.settings." .. server)
if config_exists then
opts = vim.tbl_deep_extend("force", conf_opts, opts)
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
local config_exists, conf_opts = pcall(require, "plugins.lsp.settings." .. server)
if config_exists then
opts = vim.tbl_deep_extend("force", conf_opts, opts)
end
lspconfig[server].setup(opts)
end
lspconfig[server].setup(opts)
end

View File

@ -1,18 +0,0 @@
local cfg = require("yaml-companion").setup({
lspconfig = {
settings = {
redhat = {
telemetry = {
enabled = false,
},
},
-- yaml = {
-- schemas = {
-- ["https://custom/github-workflow.json"] = "/.github/workflows/*",
-- },
-- },
},
},
})
return cfg

View File

@ -18,12 +18,6 @@ local diff = {
cond = hide_in_width,
}
local filetype = {
"filetype",
colored = false,
separator = "",
}
local lsp_progress = {
"lsp_progress",
display_components = { "spinner" },
@ -50,18 +44,18 @@ local venv = function()
return ""
end
local get_schema = function()
local get_filetype = function()
local ft = vim.bo.filetype or ""
if ft == "yaml" then
local schema = require("yaml-companion").get_buf_schema(0)
if schema.result[1].name == "none" then
return ""
return ft
end
return "(" .. schema.result[1].name .. ")"
return ft .. " (" .. schema.result[1].name .. ")"
else
return ""
return ft
end
end
@ -111,8 +105,7 @@ require("lualine").setup({
diff,
spaces,
"encoding",
filetype,
{ get_schema, separator = "" },
{ get_filetype, separator = "" },
},
lualine_y = { "progress" },
lualine_z = { "location" },