init
This commit is contained in:
53
lua/lsp/init.lua
Normal file
53
lua/lsp/init.lua
Normal file
@ -0,0 +1,53 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local servers = {
|
||||
ts_ls = { filetypes = { 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' } },
|
||||
gopls = { filetypes = { 'go', 'gomod' } },
|
||||
rust_analyzer = {
|
||||
filetypes = { 'rust' },
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
check = {
|
||||
command = 'clippy',
|
||||
extraArgs = {
|
||||
'--',
|
||||
'-Dclippy::correctness',
|
||||
'-Wclippy::complexity',
|
||||
'-Wclippy::pedantic',
|
||||
'-Wclippy::perf',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
golangci_lint_ls = require 'lsp.golangci_lint_ls',
|
||||
erlangls = { cmd = { '/home/fergusmolloy/.local/bin/erlang_ls' }, filetypes = { 'erlang' } },
|
||||
elixirls = { cmd = { 'elixir-ls' }, filetypes = { 'elixir' } },
|
||||
lua_ls = require 'lsp.lua_ls',
|
||||
}
|
||||
|
||||
local on_attach = require 'lsp.on_attach'
|
||||
local lspconfig = require 'lspconfig'
|
||||
|
||||
for server, config in pairs(servers) do
|
||||
if require('lsp.utils').check_ft(server, config) then
|
||||
if config['enable'] then
|
||||
if not config['enable']() then
|
||||
vim.notify('Disabling language server ' .. server, vim.log.levels.WARN)
|
||||
goto continue
|
||||
end
|
||||
end
|
||||
else
|
||||
goto continue
|
||||
end
|
||||
config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
|
||||
config.on_attach = require 'lsp.on_attach'
|
||||
vim.lsp.enable(server)
|
||||
vim.lsp.config(server, config)
|
||||
|
||||
::continue::
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user