Another copy of my dotfiles. Because I don't completely trust GitHub.
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.

57 lines
1.5 KiB

  1. local function mergeTables(t1, t2)
  2. for k, v in pairs(t2) do
  3. t1[k] = v
  4. end
  5. return t1
  6. end
  7. -- === Initialize LSP Servers ===
  8. -- For a list of LSP Servers and documentation:
  9. -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
  10. local lspconfig = require'lspconfig'
  11. local capabilities = require('cmp_nvim_lsp').default_capabilities()
  12. local configs = require("config.lsp").lspconfigs
  13. local on_attach = require("config.lsp").lsp_onattach
  14. capabilities.textDocument.completion.completionItem.snippetSupport = true
  15. capabilities.textDocument.foldingRange = {
  16. dynamicRegistration = false,
  17. lineFoldingOnly = true
  18. }
  19. -- LSP diagnostics
  20. vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
  21. underline = true,
  22. signs = true,
  23. virtual_text = false,
  24. severity_sort = true,
  25. })
  26. local signs = {
  27. Error = "",
  28. Warning = "",
  29. Hint = "",
  30. Information = ""
  31. }
  32. for type, icon in pairs(signs) do
  33. local hl = "LspDiagnosticsSign" .. type
  34. vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
  35. end
  36. -- LSP diagnostics
  37. vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
  38. underline = true,
  39. signs = true,
  40. virtual_text = true,
  41. severity_sort = true,
  42. })
  43. for k, v in pairs(configs) do
  44. lspconfig[k].setup(
  45. mergeTables(v, {
  46. on_attach = on_attach,
  47. capabilities = capabilities
  48. }))
  49. end