| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 | 
							- local M = {}
 
- local u = require "utils"
 
- function M.config()
 
-   vim.lsp.protocol.CompletionItemKind = lvim.lsp.completion.item_kind
 
-   for _, sign in ipairs(lvim.lsp.diagnostics.signs.values) do
 
-     vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name })
 
-   end
 
-   require("lsp.handlers").setup()
 
- end
 
- local function lsp_highlight_document(client)
 
-   if lvim.lsp.document_highlight == false then
 
-     return -- we don't need further
 
-   end
 
-   -- Set autocommands conditional on server_capabilities
 
-   if client.resolved_capabilities.document_highlight then
 
-     vim.api.nvim_exec(
 
-       [[
 
-       hi LspReferenceRead cterm=bold ctermbg=red guibg=#464646
 
-       hi LspReferenceText cterm=bold ctermbg=red guibg=#464646
 
-       hi LspReferenceWrite cterm=bold ctermbg=red guibg=#464646
 
-       augroup lsp_document_highlight
 
-         autocmd! * <buffer>
 
-         autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
 
-         autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
 
-       augroup END
 
-     ]],
 
-       false
 
-     )
 
-   end
 
- end
 
- local function add_lsp_buffer_keybindings(bufnr)
 
-   local wk = require "which-key"
 
-   local keys = {
 
-     ["K"] = { "<cmd>lua vim.lsp.buf.hover()<CR>", "Show hover" },
 
-     ["gd"] = { "<cmd>lua vim.lsp.buf.definition()<CR>", "Goto Definition" },
 
-     ["gD"] = { "<cmd>lua vim.lsp.buf.declaration()<CR>", "Goto declaration" },
 
-     ["gr"] = { "<cmd>lua vim.lsp.buf.references()<CR>", "Goto references" },
 
-     ["gi"] = { "<cmd>lua vim.lsp.buf.implementation()<CR>", "Goto implementation" },
 
-     ["gs"] = { "<cmd>lua vim.lsp.buf.signature_help()<CR>", "show signature help" },
 
-     ["gp"] = { "<cmd>lua require'lsp.peek'.Peek('definition')<CR>", "Peek definition" },
 
-     ["gl"] = {
 
-       "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics({ show_header = false, border = 'single' })<CR>",
 
-       "Show line diagnostics",
 
-     },
 
-   }
 
-   wk.register(keys, { mode = "n", buffer = bufnr })
 
- end
 
- function M.common_capabilities()
 
-   local capabilities = vim.lsp.protocol.make_client_capabilities()
 
-   capabilities.textDocument.completion.completionItem.snippetSupport = true
 
-   capabilities.textDocument.completion.completionItem.resolveSupport = {
 
-     properties = {
 
-       "documentation",
 
-       "detail",
 
-       "additionalTextEdits",
 
-     },
 
-   }
 
-   return capabilities
 
- end
 
- function M.common_on_init(client, bufnr)
 
-   if lvim.lsp.on_init_callback then
 
-     lvim.lsp.on_init_callback(client, bufnr)
 
-     return
 
-   end
 
-   local formatters = lvim.lang[vim.bo.filetype].formatters
 
-   if not vim.tbl_isempty(formatters) and formatters[1]["exe"] ~= nil and formatters[1].exe ~= "" then
 
-     client.resolved_capabilities.document_formatting = false
 
-     u.lvim_log(string.format("Overriding [%s] formatter with [%s]", client.name, formatters[1].exe))
 
-   end
 
- end
 
- function M.common_on_attach(client, bufnr)
 
-   if lvim.lsp.on_attach_callback then
 
-     lvim.lsp.on_attach_callback(client, bufnr)
 
-   end
 
-   lsp_highlight_document(client)
 
-   add_lsp_buffer_keybindings(bufnr)
 
-   if lvim.lsp.smart_cwd then
 
-     vim.api.nvim_set_current_dir(client.config.root_dir)
 
-     require("core.nvimtree").change_tree_dir(client.config.root_dir)
 
-   end
 
-   require("lsp.null-ls").setup(vim.bo.filetype)
 
- end
 
- function M.setup(lang)
 
-   local lsp = lvim.lang[lang].lsp
 
-   if require("utils").check_lsp_client_active(lsp.provider) then
 
-     return
 
-   end
 
-   local overrides = lvim.lsp.override
 
-   if type(overrides) == "table" then
 
-     if u.has_value(overrides, lang) then
 
-       return
 
-     end
 
-   end
 
-   local lspconfig = require "lspconfig"
 
-   lspconfig[lsp.provider].setup(lsp.setup)
 
- end
 
- return M
 
 
  |