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

47 lines
1.1 KiB
Lua
Raw Normal View History

2023-06-21 23:44:34 +02:00
local lsp_present, lspconfig = pcall(require, "lspconfig")
if not lsp_present then
return
end
2023-02-11 02:36:46 +01:00
local M = {}
M.setup = function(opts)
2023-07-01 20:23:44 +02:00
lspconfig.astro.setup(opts)
2023-07-04 21:20:01 +02:00
lspconfig.cssls.setup(opts)
2023-06-22 01:13:57 +02:00
lspconfig.emmet_ls.setup(opts)
2023-06-21 23:44:34 +02:00
lspconfig.graphql.setup(vim.tbl_extend("keep", {
2023-03-17 09:23:43 +01:00
filetypes = {
"graphql",
"typescriptreact",
"javascriptreact",
"typescript",
},
2023-06-21 23:44:34 +02:00
}, opts))
2023-07-04 21:20:01 +02:00
lspconfig.html.setup(opts)
2023-06-21 23:44:34 +02:00
lspconfig.intelephense.setup(opts)
lspconfig.tailwindcss.setup(vim.tbl_extend("keep", {
2023-02-11 02:36:46 +01:00
filetypes = {
2023-07-01 20:23:44 +02:00
"astro",
2023-02-11 02:36:46 +01:00
"javascriptreact",
"typescriptreact",
"html",
"css",
},
2023-06-21 23:44:34 +02:00
}, opts))
2023-02-11 02:36:46 +01:00
-- attach tsserver only when there's a 'package.json' file in the CWD
2023-06-21 23:44:34 +02:00
lspconfig.tsserver.setup(vim.tbl_extend("keep", {
2023-02-11 02:36:46 +01:00
root_dir = lspconfig.util.root_pattern("package.json"),
single_file_support = false,
2023-06-21 23:44:34 +02:00
}, opts))
2023-02-11 02:36:46 +01:00
-- attach deno only when there's a 'deps.ts' file in the CWD
2023-06-21 23:44:34 +02:00
lspconfig.denols.setup(vim.tbl_extend("keep", {
2023-02-11 02:36:46 +01:00
root_dir = lspconfig.util.root_pattern("deps.ts"),
single_file_support = false,
2023-06-21 23:44:34 +02:00
}, opts))
2023-02-11 02:36:46 +01:00
end
return M