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.
115 lines
2.4 KiB
Lua
115 lines
2.4 KiB
Lua
# chezmoi:template:left-delimiter=--{{
|
|
--{{- /* vim: set filetype=lua: */ -}}
|
|
local M = { 'neovim/nvim-lspconfig' }
|
|
|
|
M.name = 'lspconfig'
|
|
M.tag = 'v1.0.0'
|
|
|
|
M.dependencies = {
|
|
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
|
|
{ 'folke/trouble.nvim', tag = 'v3.6.0' },
|
|
{ 'folke/lazydev.nvim', tag = 'v1.9.0', ft = "lua", opts = {} },
|
|
}
|
|
|
|
|
|
local function format_buffer(_)
|
|
vim.lsp.buf.format()
|
|
end
|
|
|
|
local function on_attach(_, buffer)
|
|
-- Create a command `:Format` local to the LSP buffer
|
|
vim.api.nvim_buf_create_user_command(buffer, 'Format', format_buffer, {
|
|
desc = 'Format current buffer with LSP',
|
|
})
|
|
end
|
|
|
|
function M.config()
|
|
local lspconfig = require('lspconfig')
|
|
|
|
local capabilities = require('cmp_nvim_lsp').default_capabilities(
|
|
vim.lsp.protocol.make_client_capabilities())
|
|
|
|
--{{ if lookPath "bash-language-server" -}}
|
|
-- npm install --global bash-language-server
|
|
lspconfig.bashls.setup {
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = {},
|
|
}
|
|
--{{- end }}
|
|
--
|
|
--{{ if lookPath "buf" -}}
|
|
lspconfig.buf_ls.setup {
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = {},
|
|
}
|
|
--{{- end }}
|
|
|
|
--{{ if lookPath "go" -}}
|
|
lspconfig.gopls.setup {
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = {},
|
|
}
|
|
--{{- end }}
|
|
|
|
--{{ if lookPath "nu" -}}
|
|
lspconfig.nushell.setup {
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = {},
|
|
}
|
|
--{{- end }}
|
|
|
|
--{{ if lookPath "templ" -}}
|
|
lspconfig.templ.setup {
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = {},
|
|
}
|
|
--{{- end }}
|
|
|
|
--{{ if lookPath "vscode-eslint-language-server" -}}
|
|
-- # npm i -g vscode-langservers-extracted
|
|
lspconfig.eslint.setup {
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = {},
|
|
}
|
|
|
|
lspconfig.html.setup {
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = {},
|
|
}
|
|
|
|
lspconfig.cssls.setup {
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = {},
|
|
}
|
|
|
|
lspconfig.jsonls.setup {
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = {},
|
|
}
|
|
--{{- end }}
|
|
|
|
--{{ if lookPath "lua-language-server" -}}
|
|
lspconfig.lua_ls.setup {
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = {
|
|
Lua = {
|
|
workspace = { checkThirdParty = false },
|
|
telemetry = { enable = false },
|
|
},
|
|
},
|
|
}
|
|
--{{- end }}
|
|
end
|
|
|
|
return M
|