mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2025-09-19 22:39:08 +00:00
[neovim] Remove yaml-companion and add SchemaStore.nvim
This commit is contained in:
@@ -177,30 +177,7 @@ require("lazy").setup({
|
|||||||
{ "f-person/git-blame.nvim" },
|
{ "f-person/git-blame.nvim" },
|
||||||
|
|
||||||
-- YAML
|
-- YAML
|
||||||
{
|
{ "b0o/schemastore.nvim" },
|
||||||
"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
|
-- DAP
|
||||||
{ "mfussenegger/nvim-dap", event = "VeryLazy", version = "0.*" },
|
{ "mfussenegger/nvim-dap", event = "VeryLazy", version = "0.*" },
|
||||||
|
@@ -22,9 +22,9 @@ require("blink.cmp").setup({
|
|||||||
window = { border = "single" },
|
window = { border = "single" },
|
||||||
},
|
},
|
||||||
menu = {
|
menu = {
|
||||||
-- don't show completion menu automatically when searching
|
|
||||||
auto_show = function(ctx)
|
auto_show = function(ctx)
|
||||||
return ctx.mode ~= "cmdline" or not vim.tbl_contains({ "/", "?" }, vim.fn.getcmdtype())
|
return vim.fn.getcmdtype() == ":"
|
||||||
end,
|
end,
|
||||||
|
|
||||||
border = "single",
|
border = "single",
|
||||||
|
@@ -34,9 +34,8 @@ require("mason-lspconfig").setup({
|
|||||||
automatic_installation = true,
|
automatic_installation = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
local lspconfig = require("lspconfig")
|
|
||||||
for _, server in pairs(servers) do
|
for _, server in pairs(servers) do
|
||||||
if server ~= "yamlls" then
|
if server ~= "ty" then
|
||||||
local opts = {
|
local opts = {
|
||||||
capabilities = require("blink.cmp").get_lsp_capabilities(),
|
capabilities = require("blink.cmp").get_lsp_capabilities(),
|
||||||
}
|
}
|
||||||
@@ -49,6 +48,6 @@ for _, server in pairs(servers) do
|
|||||||
opts = vim.tbl_deep_extend("force", conf_opts, opts)
|
opts = vim.tbl_deep_extend("force", conf_opts, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
lspconfig[server].setup(opts)
|
vim.lsp.config(server, opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
33
.config/nvim/lua/plugins/lsp/settings/yamlls.lua
Normal file
33
.config/nvim/lua/plugins/lsp/settings/yamlls.lua
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
return {
|
||||||
|
-- Have to add this for yamlls to understand that we support line folding
|
||||||
|
capabilities = {
|
||||||
|
textDocument = {
|
||||||
|
foldingRange = {
|
||||||
|
dynamicRegistration = false,
|
||||||
|
lineFoldingOnly = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- lazy-load schemastore when needed
|
||||||
|
before_init = function(_, new_config)
|
||||||
|
new_config.settings.yaml.schemas =
|
||||||
|
vim.tbl_deep_extend("force", new_config.settings.yaml.schemas or {}, require("schemastore").yaml.schemas())
|
||||||
|
end,
|
||||||
|
positos = {},
|
||||||
|
settings = {
|
||||||
|
redhat = { telemetry = { enabled = false } },
|
||||||
|
yaml = {
|
||||||
|
keyOrdering = false,
|
||||||
|
format = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
validate = true,
|
||||||
|
schemaStore = {
|
||||||
|
-- disable built-in schemaStore support
|
||||||
|
enable = false,
|
||||||
|
-- Avoid TypeError: Cannot read properties of undefined (reading 'length')
|
||||||
|
url = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
@@ -49,21 +49,6 @@ local venv = function()
|
|||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
local get_filetype = function()
|
|
||||||
local ft = vim.bo.filetype or ""
|
|
||||||
|
|
||||||
if ft == "yaml" then
|
|
||||||
local schema = require("yaml-companion").get_buf_schema(0)
|
|
||||||
if not schema or not schema.result or not schema.result[1].name then
|
|
||||||
return ft
|
|
||||||
end
|
|
||||||
|
|
||||||
return ft .. " (" .. schema.result[1].name .. ")"
|
|
||||||
else
|
|
||||||
return ft
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local gitblame = require("gitblame")
|
local gitblame = require("gitblame")
|
||||||
|
|
||||||
vim.g.gitblame_date_format = "%r"
|
vim.g.gitblame_date_format = "%r"
|
||||||
@@ -170,7 +155,12 @@ require("lualine").setup({
|
|||||||
diff,
|
diff,
|
||||||
spaces,
|
spaces,
|
||||||
"encoding",
|
"encoding",
|
||||||
{ get_filetype, separator = "" },
|
{
|
||||||
|
"filetype",
|
||||||
|
colored = false,
|
||||||
|
icon_only = false,
|
||||||
|
icon = { align = "left" },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
lualine_y = { "progress" },
|
lualine_y = { "progress" },
|
||||||
lualine_z = { "location" },
|
lualine_z = { "location" },
|
||||||
|
@@ -39,4 +39,3 @@ telescope.setup({
|
|||||||
|
|
||||||
telescope.load_extension("fzf")
|
telescope.load_extension("fzf")
|
||||||
telescope.load_extension("ui-select")
|
telescope.load_extension("ui-select")
|
||||||
telescope.load_extension("yaml_schema")
|
|
||||||
|
Reference in New Issue
Block a user