mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2024-12-22 11:38:00 +00:00
[neovim] Fix yaml-companion
This commit is contained in:
parent
d5c9273e44
commit
fb9748c38d
@ -179,7 +179,6 @@ require("lazy").setup({
|
||||
{ "folke/trouble.nvim", cmd = { "TroubleToggle", "Trouble" } },
|
||||
{ "glepnir/lspsaga.nvim", event = "BufRead" },
|
||||
{ "arkav/lualine-lsp-progress" },
|
||||
{ "someone-stole-my-name/yaml-companion.nvim", event = "BufRead" },
|
||||
|
||||
-- Telescope
|
||||
{ "nvim-telescope/telescope.nvim", cmd = "Telescope" },
|
||||
@ -191,6 +190,32 @@ require("lazy").setup({
|
||||
{ "sindrets/diffview.nvim" },
|
||||
{ "f-person/git-blame.nvim" },
|
||||
|
||||
-- YAML
|
||||
{
|
||||
"someone-stole-my-name/yaml-companion.nvim",
|
||||
ft = { "yaml" },
|
||||
opts = {
|
||||
lspconfig = {
|
||||
settings = {
|
||||
redhat = {
|
||||
telemetry = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
-- yaml = {
|
||||
-- schemas = {
|
||||
-- ["https://custom/github-workflow.json"] = "/.github/workflows/*",
|
||||
-- },
|
||||
-- },
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local cfg = require("yaml-companion").setup(opts)
|
||||
require("lspconfig")["yamlls"].setup(cfg)
|
||||
end,
|
||||
},
|
||||
|
||||
-- DAP
|
||||
{ "mfussenegger/nvim-dap", event = "VeryLazy", version = "0.*" },
|
||||
{ "rcarriga/nvim-dap-ui", event = "VeryLazy", version = "v3.*" },
|
||||
@ -208,6 +233,9 @@ require("lazy").setup({
|
||||
ft = { "go", "gomod" },
|
||||
},
|
||||
|
||||
-- Typescript
|
||||
{ "pmizio/typescript-tools.nvim", opts = {} },
|
||||
|
||||
-- Markdown
|
||||
{ "mzlogin/vim-markdown-toc" },
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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
|
@ -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" },
|
||||
|
Loading…
Reference in New Issue
Block a user