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.

105 lines
2.3 KiB
Cheetah

# chezmoi:template:left-delimiter=--{{
--{{- /* vim: set filetype=lua: */ -}}
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
local function 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 "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 {
'neovim/nvim-lspconfig',
name = 'lspconfig',
tag = 'v1.0.0',
config = config,
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 = {} },
},
}