return {
  {
    "smjonas/inc-rename.nvim",
    opts = {}
  },
  {
    {
      "mason-org/mason-lspconfig.nvim",
      opts = {
        ensure_installed = { "lexical" }
      },
      dependencies = {
        { "mason-org/mason.nvim",        opts = {} },
        { "neovim/nvim-lspconfig" },
        { "hrsh7th/nvim-cmp" },
        { "hrsh7th/cmp-nvim-lsp" },
        { "hrsh7th/cmp-buffer" },
        { "hrsh7th/cmp-path" },
        { "saadparwaiz1/cmp_luasnip" },
        { "L3MON4D3/LuaSnip" },
        { "rafamadriz/friendly-snippets" },
      },
      config = function()
        vim.api.nvim_create_autocmd('LspAttach', {
          desc = 'LSP actions',
          callback = function()
            local bufmap = function(mode, lhs, rhs)
              local opts = { buffer = true }
              vim.keymap.set(mode, lhs, rhs, opts)
            end

            bufmap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>')
            bufmap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>')
            bufmap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>')
            bufmap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>')
            bufmap('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>')
            bufmap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>')
            bufmap('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>')
            bufmap('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>')
            bufmap('n', '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>')
            bufmap('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>')
            bufmap('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<cr>')
            bufmap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>')
            bufmap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>')
          end
        })


        ---
        -- Diagnostics
        ---

        vim.diagnostic.config({
          virtual_text = true,
          severity_sort = true,
          float = {
            border = 'rounded',
            source = 'always',
          },
        })

        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' }
        )

        ---
        -- LSP servers
        ---

        -- require('mason').setup({})
        -- require('mason-lspconfig').setup({})

        local lspconfig = require('lspconfig')
        local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities()

        lspconfig.tsserver.setup({
          capabilities = lsp_capabilities,
        })
        lspconfig.lua_ls.setup({
          capabilities = lsp_capabilities,
        })


        ---
        -- Autocomplete
        ---
        vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }

        require('luasnip.loaders.from_vscode').lazy_load()

        local cmp = require('cmp')
        local luasnip = require('luasnip')

        local select_opts = { behavior = cmp.SelectBehavior.Select }

        cmp.setup({
          snippet = {
            expand = function(args)
              luasnip.lsp_expand(args.body)
            end
          },
          sources = {
            { name = 'path' },
            { name = 'render-markdown' },
            { name = 'nvim_lsp',       keyword_length = 1 },
            { name = 'buffer',         keyword_length = 3 },
            { name = 'luasnip',        keyword_length = 2 },
          },
          window = {
            documentation = cmp.config.window.bordered()
          },
          formatting = {
            fields = { 'menu', 'abbr', 'kind' },
            format = function(entry, item)
              local menu_icon = {
                nvim_lsp = 'λ',
                luasnip = '⋗',
                buffer = 'Ω',
                path = '🖫',
              }

              item.menu = menu_icon[entry.source.name]
              return item
            end,
          },
          mapping = {
            ['<Up>'] = cmp.mapping.select_prev_item(select_opts),
            ['<Down>'] = cmp.mapping.select_next_item(select_opts),

            ['<C-p>'] = cmp.mapping.select_prev_item(select_opts),
            ['<C-n>'] = cmp.mapping.select_next_item(select_opts),

            ['<C-u>'] = cmp.mapping.scroll_docs(-4),
            ['<C-d>'] = cmp.mapping.scroll_docs(4),

            ['<C-e>'] = cmp.mapping.abort(),
            ['<C-y>'] = cmp.mapping.confirm({ select = true }),
            ['<CR>'] = cmp.mapping.confirm({ select = false }),

            ['<C-f>'] = cmp.mapping(function(fallback)
              if luasnip.jumpable(1) then
                luasnip.jump(1)
              else
                fallback()
              end
            end, { 'i', 's' }),

            ['<C-b>'] = cmp.mapping(function(fallback)
              if luasnip.jumpable(-1) then
                luasnip.jump(-1)
              else
                fallback()
              end
            end, { 'i', 's' }),

            ['<Tab>'] = cmp.mapping(function(fallback)
              local col = vim.fn.col('.') - 1

              if cmp.visible() then
                cmp.select_next_item(select_opts)
              elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
                fallback()
              else
                cmp.complete()
              end
            end, { 'i', 's' }),

            ['<S-Tab>'] = cmp.mapping(function(fallback)
              if cmp.visible() then
                cmp.select_prev_item(select_opts)
              else
                fallback()
              end
            end, { 'i', 's' }),
          },
        })
      end
    }
  },
  {
    "lukas-reineke/lsp-format.nvim",
    config = function()
      require("lsp-format").setup {}

      vim.api.nvim_create_autocmd('LspAttach', {
        callback = function(args)
          local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
          require("lsp-format").on_attach(client, args.buf)
        end,
      })
    end,
  },
}
