From 684445b4f7b4b3fae3a3e098b0fa33b1cecb32e5 Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Sun, 26 Jan 2025 05:59:59 +0100 Subject: [PATCH] Added back in schemastore support --- nvim/dot-config/nvim/lua/plugins/lsp.lua | 4 +- nvim/dot-config/nvim/lua/plugins/mason.lua | 8 +- nvim/dot-config/nvim/lua/tools.lua | 96 +++++++++++----------- 3 files changed, 55 insertions(+), 53 deletions(-) diff --git a/nvim/dot-config/nvim/lua/plugins/lsp.lua b/nvim/dot-config/nvim/lua/plugins/lsp.lua index 6f11e99..c1747e4 100644 --- a/nvim/dot-config/nvim/lua/plugins/lsp.lua +++ b/nvim/dot-config/nvim/lua/plugins/lsp.lua @@ -120,14 +120,14 @@ return { } local handler = function(server_name) - local server = require("tools").servers[server_name] or {} + local server = require("tools").servers()[server_name] or {} server.capabilities = vim.tbl_deep_extend("force", capabilities, server.capabilities or {}) server.handlers = handlers require("lspconfig")[server_name].setup(server) end - for server, config in pairs(require("tools").servers) do + for server, config in pairs(require("tools").servers()) do if config.system then handler(server) end diff --git a/nvim/dot-config/nvim/lua/plugins/mason.lua b/nvim/dot-config/nvim/lua/plugins/mason.lua index 486f70e..b49b84d 100644 --- a/nvim/dot-config/nvim/lua/plugins/mason.lua +++ b/nvim/dot-config/nvim/lua/plugins/mason.lua @@ -15,13 +15,13 @@ return { }, config = function() local tools = require("tools") - local ensure_installed = vim.tbl_keys(vim.tbl_map(function(server) - if server.system then + local ensure_installed = vim.tbl_keys(vim.tbl_map(function(tool) + if tool.system then return nil else - return server + return tool end - end, tools.servers)) + end, tools.servers())) ensure_installed = vim.list_extend(ensure_installed, require("util.mason").process_formatters(tools.formatters)) ensure_installed = vim.list_extend(ensure_installed, tools.extra) diff --git a/nvim/dot-config/nvim/lua/tools.lua b/nvim/dot-config/nvim/lua/tools.lua index 7dab5e4..8285083 100644 --- a/nvim/dot-config/nvim/lua/tools.lua +++ b/nvim/dot-config/nvim/lua/tools.lua @@ -1,60 +1,62 @@ local tools = {} -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md -tools.servers = { - clangd = { - cmd = { "clangd", "--offset-encoding=utf-16", "--clang-tidy" }, - }, - gopls = {}, - pyright = {}, - rust_analyzer = { - system = true, - settings = { - ["rust-analyzer"] = { - check = { - command = "clippy", +tools.servers = function() + return { + clangd = { + cmd = { "clangd", "--offset-encoding=utf-16", "--clang-tidy" }, + }, + gopls = {}, + pyright = {}, + rust_analyzer = { + system = true, + settings = { + ["rust-analyzer"] = { + check = { + command = "clippy", + }, }, }, }, - }, - lua_ls = { - settings = { - Lua = { - workspace = { checkThirdParty = false }, - telemetry = { enable = false }, - }, - }, - }, - jsonls = { - settings = { - json = { - validate = { enable = true }, - -- schemas = require("schemastore").json.schemas(), - }, - }, - }, - yamlls = { - settings = { - yaml = { - schemaStore = { - enable = false, - url = "", + lua_ls = { + settings = { + Lua = { + workspace = { checkThirdParty = false }, + telemetry = { enable = false }, }, - -- schemas = require("schemastore").yaml.schemas(), }, }, - }, - taplo = {}, - neocmake = {}, - nil_ls = { - system = true, - }, - typos_lsp = { - init_options = { - diagnosticSeverity = "Hint", + jsonls = { + settings = { + json = { + validate = { enable = true }, + schemas = require("schemastore").json.schemas(), + }, + }, }, - }, -} + yamlls = { + settings = { + yaml = { + schemaStore = { + enable = false, + url = "", + }, + schemas = require("schemastore").yaml.schemas(), + }, + }, + }, + taplo = {}, + neocmake = {}, + nil_ls = { + system = true, + }, + typos_lsp = { + init_options = { + diagnosticSeverity = "Hint", + }, + }, + } +end -- https://github.com/stevearc/conform.nvim tools.formatters = require("util.conform").assign_formatters({