return {
  'neovim/nvim-lspconfig',
  ft = { 'lua', 'rust', 'python' },
  config = function()
    require('lspconfig.ui.windows').default_options = {
      border = 'single',
    }

    vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, {
      border = 'single',
    })
    vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, {
      border = 'single',
      close_events = { 'CursorMoved', 'BufHidden', 'InsertCharPre' },
    })

    local on_attach = function(client, bufnr)
      local nmap = function(keys, func, desc)
        if desc then
          desc = 'LSP: ' .. desc
        end
        vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })

        if client.server_capabilities.documentHighlightProvider then
          vim.api.nvim_create_augroup('lsp_document_highlight', { clear = true })
          vim.api.nvim_clear_autocmds { buffer = bufnr, group = 'lsp_document_highlight' }
          vim.api.nvim_create_autocmd('CursorHold', {
            callback = vim.lsp.buf.document_highlight,
            buffer = bufnr,
            group = 'lsp_document_highlight',
            desc = 'Document Highlight',
          })
          vim.api.nvim_create_autocmd('CursorMoved', {
            callback = vim.lsp.buf.clear_references,
            buffer = bufnr,
            group = 'lsp_document_highlight',
            desc = 'Clear All the References',
          })
        end
      end

      local builtin = require 'telescope.builtin'

      -- nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
      -- nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
      -- nmap('gd', builtin.lsp_definitions, '[G]oto [D]efinition')
      nmap('<leader>rn', '<cmd>Lspsaga rename<CR>', '[R]e[n]ame')
      nmap('<leader>ca', '<cmd>Lspsaga code_action<CR>', '[C]ode [A]ction')
      nmap('gf', '<cmd>Lspsaga finder<CR>', '[G]oto [F]inder')
      nmap('gd', '<cmd>Lspsaga peek_definition<CR>', '[G]oto [D]efinition')
      nmap('gr', builtin.lsp_references, '[G]oto [R]eferences')
      nmap('gI', builtin.lsp_implementations, '[G]oto [I]mplementation')
      nmap('<leader>D', builtin.lsp_type_definitions, 'Type [D]efinition')
      nmap('<leader>ds', builtin.lsp_document_symbols, '[D]ocument [S]ymbols')
      nmap('<leader>ws', builtin.lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')

      -- See `:help K` for why this keymap
      -- nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
      nmap('K', '<cmd>Lspsaga hover_doc<CR>', 'Hover Documentation')
      vim.keymap.set({ 'n', 'i' }, '<C-k>', vim.lsp.buf.signature_help, { buffer = bufnr, desc = 'Signature Help' })

      -- Lesser used LSP functionality
      nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
      nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
      nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
      nmap('<leader>wl', function()
        print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
      end, '[W]orkspace [L]ist Folders')
    end

    -- nvim-cmp supports additional completion capabilities, so broadcast that to servers
    local capabilities = vim.lsp.protocol.make_client_capabilities()
    capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
    capabilities.textDocument.completion.completionItem.snippetSupport = true

    require('lspconfig').pylsp.setup {
      capabilities = capabilities,
      on_attach = on_attach,
    }

    require('lspconfig').rust_analyzer.setup {
      capabilities = capabilities,
      on_attach = on_attach,
      cmd = { 'rustup', 'run', 'stable', 'rust-analyzer' },
    }

    require('lspconfig').lua_ls.setup {
      capabilities = capabilities,
      on_attach = on_attach,
      settings = {
        Lua = {
          runtime = {
            version = 'LuaJIT',
          },
          completion = {
            workspaceWord = true,
            callSnippet = 'Both',
          },
          diagnostics = {
            globals = { 'vim' },
          },
          format = {
            enable = false,
          },
          workspace = {
            library = vim.api.nvim_get_runtime_file('', true),
            checkThirdParty = false,
          },
          telemetry = { enable = false },
        },
      },
    }
  end,
}
