removed Mason

This commit is contained in:
dlond 2025-05-16 10:39:38 +12:00
parent f1624aff86
commit d9c09a23cd
4 changed files with 149 additions and 246 deletions

View File

@ -482,13 +482,6 @@ require('lazy').setup({
-- Main LSP Configuration
'neovim/nvim-lspconfig',
dependencies = {
-- Automatically install LSPs and related tools to stdpath for Neovim
-- Mason must be loaded before its dependents so we need to set it up here.
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
{ 'mason-org/mason.nvim', opts = {} },
'mason-org/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
-- Useful status updates for LSP.
{ 'j-hui/fidget.nvim', opts = {} },
@ -515,9 +508,6 @@ require('lazy').setup({
-- - Symbol Search
-- - and more!
--
-- Thus, Language Servers are external tools that must be installed separately from
-- Neovim. This is where `mason` and related plugins come into play.
--
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
-- and elegantly composed help section, `:help lsp-vs-treesitter`
@ -702,40 +692,6 @@ require('lazy').setup({
},
},
}
-- Ensure the servers and tools above are installed
--
-- To check the current status of installed tools and/or manually install
-- other tools, you can run
-- :Mason
--
-- You can press `g?` for help in this menu.
--
-- `mason` had to be setup earlier: to configure its options see the
-- `dependencies` table for `nvim-lspconfig` above.
--
-- You can add other tools here that you want Mason to install
-- for you, so that they are available from within Neovim.
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
'stylua', -- Used to format Lua code
})
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
require('mason-lspconfig').setup {
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
automatic_installation = false,
handlers = {
function(server_name)
local server = servers[server_name] or {}
-- This handles overriding only values explicitly passed
-- by the server configuration above. Useful when disabling
-- certain features of an LSP (for example, turning off formatting for ts_ls)
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server)
end,
},
}
end,
},

View File

@ -1,30 +1,8 @@
return {
-- ========================================
-- LSP Configuration Override (via mason-lspconfig)
-- LSP Configuration Override
-- ========================================
{
'neovim/nvim-lspconfig',
-- Define dependencies required by lspconfig and related features
dependencies = {
-- Mason must be loaded before mason-lspconfig
{ 'williamboman/mason.nvim', opts = {} }, -- Basic setup for mason
{
'williamboman/mason-lspconfig.nvim',
-- This table defines the options for mason-lspconfig
-- It tells mason-lspconfig which servers Mason should install.
opts = {
ensure_installed = {
'lua_ls',
'clangd',
'pyright',
'nil_ls',
-- Add others like 'bashls', 'yamlls', 'nixd', 'gopls', 'rust_analyzer' etc. if needed
},
},
},
-- Optional: Tool installer for linters/formatters not handled by LSP
-- 'WhoIsSethDaniel/mason-tool-installer.nvim',
-- Status updates for LSP
{ 'j-hui/fidget.nvim', opts = {} },
@ -32,24 +10,13 @@ return {
'hrsh7th/cmp-nvim-lsp',
},
config = function(_, opts)
-- This config function runs AFTER the plugin and its dependencies are loaded.
-- It sets up the LSP servers based on the configurations provided.
-- Get LSP capabilities, augmented by nvim-cmp
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
-- Call mason-lspconfig's setup function. This primarily ensures that the
-- ensure_installed list above is processed by Mason for installation.
-- We don't rely on this setup call to configure the servers below anymore.
-- require('mason-lspconfig').setup(opts) -- This might not even be needed if opts are passed automatically
-- Manually define the list of servers we want lspconfig to setup.
-- This list should match the 'ensure_installed' list for mason-lspconfig above.
local servers_to_setup = { 'lua_ls', 'clangd', 'pyright' } -- <-- EXPLICIT LIST HERE
-- Iterate through the defined servers list and set them up with lspconfig
for _, server_name in ipairs(servers_to_setup) do
-- print('Setting up LSP server: ' .. server_name) -- Debug print
require('lspconfig')[server_name].setup {
capabilities = capabilities, -- Pass augmented capabilities
-- Add any server-specific overrides here if needed
@ -85,8 +52,10 @@ return {
return client.supports_method(method, { bufnr = bufnr })
end
end
if client and client_supports_method(client, 'textDocument/documentHighlight', event.buf) then
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override', { clear = false })
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override',
{ clear = false })
vim.api.nvim_create_autocmd(
{ 'CursorHold', 'CursorHoldI' },
{ buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight }
@ -141,7 +110,6 @@ return {
},
}
end, -- End of config function
},
-- lazydev setup
{

View File

@ -17,10 +17,6 @@ return {
-- Required dependency for nvim-dap-ui
'nvim-neotest/nvim-nio',
-- Installs the debug adapters for you
'mason-org/mason.nvim',
'jay-babu/mason-nvim-dap.nvim',
-- Add your own debuggers here
'leoluz/nvim-dap-go',
},
@ -81,23 +77,6 @@ return {
local dap = require 'dap'
local dapui = require 'dapui'
require('mason-nvim-dap').setup {
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
automatic_installation = true,
-- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information
handlers = {},
-- You'll need to check that you have the required things installed
-- online, please don't ask me how to install them :)
ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want
'delve',
},
}
-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
dapui.setup {