nvim/.config/nvim/lua/plugins/lsp/init.lua

-- nvim/.config/nvim/lua/plugins/lsp/init.lua
-- Shared LSP plumbing: mason, lspconfig, capabilities, on_attach.
-- Per-language setup is imported from lua/plugins/lsp/<lang>.lua.

return {
  {
    "williamboman/mason.nvim",
    cmd = { "Mason", "MasonInstall", "MasonUninstall", "MasonUpdate" },
    build = ":MasonUpdate",
    opts = {
      ui = { border = "rounded" },
      ensure_installed = {
        "stylua", "shfmt", "shellcheck", "gofumpt", "goimports",
        "prettierd", "eslint_d", "ruff", "black",
      },
    },
  },
  {
    "williamboman/mason-lspconfig.nvim",
    dependencies = { "williamboman/mason.nvim", "neovim/nvim-lspconfig" },
    event = { "BufReadPre", "BufNewFile" },
    opts = {
      automatic_installation = false,
      ensure_installed = {
        "lua_ls", "gopls", "rust_analyzer", "pyright", "ruff",
        "ts_ls", "jsonls", "yamlls", "bashls", "dockerls",
      },
    },
  },
  {
    "neovim/nvim-lspconfig",
    event = { "BufReadPre", "BufNewFile" },
    dependencies = {
      "williamboman/mason-lspconfig.nvim",
      { "j-hui/fidget.nvim", opts = { notification = { window = { winblend = 0 } } } },
    },
    config = function()
      -- Per-language modules wire their own setup; this file only sets
      -- globals that every server inherits.
      vim.diagnostic.config({
        virtual_text = { prefix = "ยท", spacing = 2 },
        severity_sort = true,
        float = { border = "rounded", source = "if_many" },
        signs = {
          text = {
            [vim.diagnostic.severity.ERROR] = "E",
            [vim.diagnostic.severity.WARN]  = "W",
            [vim.diagnostic.severity.INFO]  = "I",
            [vim.diagnostic.severity.HINT]  = "H",
          },
        },
      })

      vim.lsp.handlers["textDocument/hover"] =
        vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" })
      vim.lsp.handlers["textDocument/signatureHelp"] =
        vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" })
    end,
  },
}