feat(extras): added extra for svelte. Full support will be enabled once my mason PR gets merged

This commit is contained in:
Folke Lemaitre 2024-06-01 09:08:09 +02:00
parent 4e62df4269
commit 7598a7503d
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -0,0 +1,52 @@
return {
recommended = function()
return LazyVim.extras.wants({
ft = "svelte",
root = {
"svelte.config.js",
"svelte.config.mjs",
"svelte.config.cjs",
},
})
end,
-- depends on the typescript extra
{ import = "lazyvim.plugins.extras.lang.typescript" },
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "svelte" })
end
end,
},
-- LSP Servers
{
"neovim/nvim-lspconfig",
opts = {
servers = {
svelte = {},
},
},
},
-- Configure tsserver plugin
{
"neovim/nvim-lspconfig",
opts = function(_, opts)
LazyVim.extend(opts.servers.vtsls, "settings.vtsls.tsserver.globalPlugins", {
{
name = "typescript-svelte-plugin",
location = LazyVim.get_pkg_path(
"svelte-language-server",
"/node_modules/typescript-svelte-plugin",
{ warn = false }
),
enableForWorkspaceTypeScriptVersions = true,
},
})
end,
},
}