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-07-13 08:37:01 +02:00
|
|
|
require("typescript-tools").setup({ on_attach = opts.on_attach })
|
2023-06-21 23:44:34 +02:00
|
|
|
|
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-07-25 15:19:47 +02:00
|
|
|
root_dir = lspconfig.util.root_pattern(
|
|
|
|
"deno.json",
|
|
|
|
"deno.jsonc",
|
|
|
|
"deps.ts"
|
|
|
|
),
|
2023-02-11 02:36:46 +01:00
|
|
|
single_file_support = false,
|
2023-06-21 23:44:34 +02:00
|
|
|
}, opts))
|
2023-02-11 02:36:46 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|