diff --git a/lua/weeheavy/plugins/lsp/lsp-zero.lua b/lua/weeheavy/plugins/lsp/lsp-zero.lua index d88dbb6..6fb632a 100644 --- a/lua/weeheavy/plugins/lsp/lsp-zero.lua +++ b/lua/weeheavy/plugins/lsp/lsp-zero.lua @@ -1,7 +1,7 @@ return { { "VonHeikemen/lsp-zero.nvim", - branch = "v3.x", + branch = "v4.x", lazy = true, config = false, init = function() @@ -90,15 +90,21 @@ return { }) -- This is where all the LSP shenanigans will live local lsp_zero = require("lsp-zero") - lsp_zero.extend_lspconfig() -- Keybindings only active when a LS is active for the curr. file - lsp_zero.on_attach(function(client, bufnr) - -- see :help lsp-zero-keybindings - -- to learn the available actions + -- lsp_zero.on_attach(function(client, bufnr) + local lsp_attach = function(client, bufnr) + -- see :help lsp-zero-keybindings to learn the available actions + -- or https://lsp-zero.netlify.app/docs/language-server-configuration.html#default-keymaps -- https://www.reddit.com/r/neovim/comments/1ankiu1/lsp_zero_go_to_definition_stopped_working/ lsp_zero.default_keymaps({ buffer = bufnr, preserve_mappings = false }) - end) + end + + lsp_zero.extend_lspconfig({ + sign_text = true, + lsp_attach = lsp_attach, + capabilities = require("cmp_nvim_lsp").default_capabilities(), + }) require("mason").setup({ ui = { @@ -124,6 +130,38 @@ return { lua_ls = function() local lua_opts = lsp_zero.nvim_lua_ls() require("lspconfig").lua_ls.setup(lua_opts) + require("lspconfig").gopls.setup({}) + require("lspconfig").yamlls.setup({ + settings = { + yaml = { + -- https://www.arthurkoziel.com/json-schemas-in-neovim/ + schemaStore = { + enable = false, + url = "", + }, + schemas = { + ["https://raw.githubusercontent.com/awslabs/goformation/master/schema/cloudformation.schema.json"] = "cf-*{yml,yaml}", + -- ["https://json.schemastore.org/kustomization.json"] = "kustomization.{yml,yaml}", + -- ["https://raw.githubusercontent.com/docker/compose/master/compose/config/compose_spec.json"] = "docker-compose*.{yml,yaml}", + -- ["https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/argoproj.io/application_v1alpha1.json"] = "argocd-application.yaml", + }, + }, + }, + }) + require("lspconfig").taplo.setup({ + -- Taplo loads all schemas (not selectively) + settings = { + evenBetterToml = { + -- https://www.arthurkoziel.com/json-schemas-in-neovim/ + schema = { + -- additional schemas + -- associations = { + -- ["alacritty\\.toml$"] = "https://raw.githubusercontent.com/distinction-dev/alacritty-schema/main/alacritty/reference.json", + -- }, + }, + }, + }, + }) end, }, })