From 6bef8f32b19778fdfe52f0eb39719425508dcc7b Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Thu, 24 Apr 2025 11:36:39 +0300 Subject: Refactored nvim config to make it easier and less insanely nested --- .config/nvim/lua/plugins/nvim-lspconfig.lua | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .config/nvim/lua/plugins/nvim-lspconfig.lua (limited to '.config/nvim/lua/plugins/nvim-lspconfig.lua') diff --git a/.config/nvim/lua/plugins/nvim-lspconfig.lua b/.config/nvim/lua/plugins/nvim-lspconfig.lua new file mode 100644 index 0000000..1dd0a77 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-lspconfig.lua @@ -0,0 +1,32 @@ +return { + -- NOTE: Make sure the order is as follows: + -- Mason loads -> Mason lspconfig loads -> Lspconfig loads + 'neovim/nvim-lspconfig', + event = { 'BufReadPre', 'BufNewFile' }, + dependencies = { + 'hrsh7th/cmp-nvim-lsp', + { 'antosha417/nvim-lsp-file-operations', conifg = true }, + { + 'williamboman/mason-lspconfig.nvim', + build = ':MasonUpdate', + config = function() + local language_servers = require('language-servers') + local ensure_installed = vim.tbl_filter(function(key) + local server = language_servers[key] + if type(server) == 'table' then + if server.mason ~= nil then + return server.mason + end + return true + else + return server + end + end, vim.tbl_keys(language_servers)) + require('mason-lspconfig').setup({ ensure_installed = ensure_installed, auto_install = true }) + end, + }, + }, + config = function() + require('lsp') + end, +} -- cgit v1.3.1