From 611a480fb779be9126ce914203cbd4eb6187e0de Mon Sep 17 00:00:00 2001 From: lefv Date: Thu, 20 Feb 2025 22:41:23 -0500 Subject: [PATCH] Fixing mason-lsp. --- lua/plugins/mason-lsp-config.lua | 64 +++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/lua/plugins/mason-lsp-config.lua b/lua/plugins/mason-lsp-config.lua index 7cb62ae..c50395a 100644 --- a/lua/plugins/mason-lsp-config.lua +++ b/lua/plugins/mason-lsp-config.lua @@ -6,28 +6,42 @@ return { ui = { border = "rounded", }, + -- Add required fields + PATH = "prepend", -- Adjust how Mason modifies the system path + log_level = vim.log.levels.INFO, + max_concurrent_installers = 4, + registries = { + "github:mason-org/mason-registry", + }, + providers = { + "mason.providers.client", + }, + github = { + download_url_template = "https://github.com/%s/releases/download/%s/%s", + }, + pip = { + upgrade_pip = false, + }, }) end, }, - { "williamboman/mason-lspconfig.nvim", dependencies = { "williamboman/mason.nvim" }, config = function() require("mason-lspconfig").setup({ ensure_installed = { - "lua_ls", -- Lua - "pyright", -- Python - "tsserver", -- TypeScript/JavaScript - "clangd", -- C/C++ + "lua_ls", -- Lua + "pyright", -- Python + "tsserver", -- TypeScript/JavaScript + "clangd", -- C/C++ "rust_analyzer", -- Rust - "gopls", -- Go + "gopls", -- Go }, automatic_installation = true, }) end, }, - { "neovim/nvim-lspconfig", dependencies = { "williamboman/mason-lspconfig.nvim" }, @@ -66,15 +80,39 @@ return { local opts = { buffer = event.buf, noremap = true, silent = true } -- Keymaps - vim.keymap.set("n", "gd", "lua vim.lsp.buf.definition()", opts) - vim.keymap.set("n", "gr", "lua vim.lsp.buf.references()", opts) + vim.keymap.set( + "n", + "gd", + "lua vim.lsp.buf.definition()", + opts + ) + vim.keymap.set( + "n", + "gr", + "lua vim.lsp.buf.references()", + opts + ) vim.keymap.set("n", "K", "lua vim.lsp.buf.hover()", opts) - vim.keymap.set("n", "rn", "lua vim.lsp.buf.rename()", opts) - vim.keymap.set("n", "ca", "lua vim.lsp.buf.code_action()", opts) - vim.keymap.set("n", "f", "lua vim.lsp.buf.format({ async = true })", opts) + vim.keymap.set( + "n", + "rn", + "lua vim.lsp.buf.rename()", + opts + ) + vim.keymap.set( + "n", + "ca", + "lua vim.lsp.buf.code_action()", + opts + ) + vim.keymap.set( + "n", + "f", + "lua vim.lsp.buf.format({ async = true })", + opts + ) end, }) end, }, } -