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

53 lines
1.5 KiB
Lua

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", "<space>fm", "<cmd>lua vim.lsp.buf.formatting()<CR>", {})
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