local lsconf = require("lspconfig") local lsp_utils = require("plugins.lsp.lsp-utils") local capabilities = lsp_utils.capabilities() local flags = { allow_incremental_sync = true, debounce_text_changes = 200, } local runtime_path = vim.split(package.path, ";") table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?/init.lua") local sumneko_root_path = "/mnt/wd1tb/catacombs/code/lua-language-server" local sumneko_binary = sumneko_root_path .. "/bin/Linux/lua-language-server" local handlers = { ["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "single" }), ["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "single" }), ["textDocument/definition"] = lsp_utils.goto_split("split"), } local on_attach = function(client, bufnr) vim.opt.signcolumn = "yes" lsp_utils.disable_formatting(client) lsp_utils.mappings(bufnr) require("lsp_signature").on_attach({ bind = true, hint_prefix = " ", fix_pos = true, padding = " ", handler_opts = { border = "shadow" }, }) if client.resolved_capabilities.document_highlight then vim.cmd([[ hi link LspReferenceRead Visual hi link LspReferenceText Visual hi link LspReferenceWrite Visual augroup lsp_document_highlight autocmd CursorHold lua vim.lsp.buf.document_highlight() autocmd CursorMoved lua vim.lsp.buf.clear_references() augroup END ]]) end end lsconf.sumneko_lua.setup({ cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" }, flags = flags, capabilities = capabilities, on_attach = on_attach, handlers = handlers, settings = { Lua = { completion = { enable = true, showWord = "Disable", }, runtime = { version = "LuaJIT", path = runtime_path, }, diagnostics = { globals = { "vim" }, }, workspace = { library = vim.api.nvim_get_runtime_file("", true), }, telemetry = { enable = false, }, }, }, }) require("lspconfig/configs").ls_emmet = { flags = flags, capabilities = capabilities, on_attach = on_attach, handlers = handlers, default_config = { cmd = { "ls_emmet", "--stdio" }, filetypes = { "html", "css", "scss", "xml", "xsl", "sass", "stylus", "less", "sss", "svelte", }, root_dir = function(fname) return vim.loop.cwd() end, settings = {}, }, } local servers = { "html", "cssls", "gopls", "tailwindcss", "vimls", "jsonls" } for _, lsp in ipairs(servers) do lsconf[lsp].setup({ on_attach = on_attach, capabilities = capabilities, handlers = handlers, flags = flags, }) end