You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.1 KiB

  1. local M = {}
  2. local servers = {
  3. 'gopls',
  4. 'html',
  5. 'jsonls',
  6. 'pyright',
  7. 'tsserver',
  8. 'vimls',
  9. 'dartls',
  10. 'dockerls',
  11. 'intelephense',
  12. 'sqlls',
  13. 'vuels',
  14. }
  15. local function on_attach(client, bufnr)
  16. -- Enable completion triggered by <C-X><C-O>
  17. -- See `:help omnifunc` and `:help ins-completion` for more information.
  18. vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
  19. -- Use LSP as the handler for formatexpr.
  20. -- See `:help formatexpr` for more information.
  21. vim.api.nvim_buf_set_option(0, "formatexpr", "v:lua.vim.lsp.formatexpr()")
  22. -- Configure key mappings
  23. require("config.lsp.keymaps").setup(client, bufnr)
  24. end
  25. local lsp_signature = require "lsp_signature"
  26. lsp_signature.setup {
  27. bind = true,
  28. handler_opts = {
  29. border = "rounded",
  30. },
  31. }
  32. local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
  33. local opts = {
  34. on_attach = on_attach,
  35. capabilities = cababilities,
  36. flags = {
  37. debounce_text_changes = 150,
  38. },
  39. }
  40. function M.setup()
  41. for _, server_name in ipairs(servers) do
  42. require('lspconfig')[server_name].setup(opts)
  43. end
  44. end
  45. return M