dotfiles/home/apps/neovim/lua/lsp/webdev.lua

50 lines
1.2 KiB
Lua
Raw Normal View History

2023-02-11 02:36:46 +01:00
local lspconfig = require("lspconfig")
local M = {}
M.setup = function(opts)
2023-03-17 09:23:43 +01:00
local common = {
2023-02-18 22:36:26 +01:00
capabilities = opts.capabilities,
on_attach = opts.on_attach,
2023-03-17 09:23:43 +01:00
}
lspconfig.cssls.setup(common)
lspconfig.emmet_ls.setup(common)
lspconfig.graphql.setup({
capabilities = opts.capabilities,
on_attach = opts.on_attach,
2023-03-17 09:23:43 +01:00
filetypes = {
"graphql",
"typescriptreact",
"javascriptreact",
"typescript",
},
})
2023-03-17 09:23:43 +01:00
lspconfig.intelephense.setup(common)
2023-02-11 02:36:46 +01:00
lspconfig.tailwindcss.setup({
capabilities = opts.capabilities,
on_attach = opts.on_attach,
filetypes = {
"javascriptreact",
"typescriptreact",
"html",
"css",
},
})
-- attach tsserver only when there's a 'package.json' file in the CWD
lspconfig.tsserver.setup({
capabilities = opts.capabilities,
on_attach = opts.on_attach,
root_dir = lspconfig.util.root_pattern("package.json"),
single_file_support = false,
})
-- attach deno only when there's a 'deps.ts' file in the CWD
lspconfig.denols.setup({
capabilities = opts.capabilities,
on_attach = opts.on_attach,
root_dir = lspconfig.util.root_pattern("deps.ts"),
single_file_support = false,
})
end
return M