summaryrefslogtreecommitdiff
path: root/lua/plugins/lsp.lua
blob: e0340bde16cf705e16f2371271fdc5b0f67efdf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
return {
  "neovim/nvim-lspconfig",
  opts = {
    servers = {
      clangd = {},
      ocamllsp = {},
      pylsp = {}
    }
  },
  config = function(_, opts)
    local lspconfig = require("lspconfig")
    local on_attach = function(client, bufnr)
      local opts = { buffer = bufnr }
      vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
      vim.keymap.set("n", "<leader>cr", vim.lsp.buf.rename, opts)
    end
    for server, config in pairs(opts.servers) do
      config.on_attach = on_attach
      config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities)
      vim.lsp.config(server, config)
      vim.lsp.enable(server)
    end
  end
}