local M = {} M.setup_lsp = function(attach, capabilities) local lspconfig = require "lspconfig" lspconfig.tsserver.setup { on_attach = function(client, bufnr) client.resolved_capabilities.document_formatting = false vim.api.nvim_buf_set_keymap(bufnr, "n", "fm", "lua vim.lsp.buf.formatting()", {}) end, } -- lspservers with default config local servers = { "html", "cssls", "bashls", "clangd", "ltex", "gopls" } for _, lsp in ipairs(servers) do lspconfig[lsp].setup { on_attach = attach, capabilities = capabilities, flags = { debounce_text_changes = 150, }, } end -- lua lsp! -- local sumneko_root_path = "/home/sid/test/sumneko_lua" -- local sumneko_binary = sumneko_root_path .. "/bin/lua-language-server" -- -- lspconfig.sumneko_lua.setup { -- cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" }, -- on_attach = attach, -- capabilities = capabilities, -- settings = { -- Lua = { -- diagnostics = { -- globals = { "vim" }, -- }, -- workspace = { -- library = { -- [vim.fn.expand "$VIMRUNTIME/lua"] = true, -- [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true, -- }, -- maxPreload = 100000, -- preloadFileSize = 10000, -- }, -- }, -- }, -- } end return M