LazyVim.LazyVim/lua/lazyvim/plugins/extras/lang/svelte.lua

52 lines
1.1 KiB
Lua

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,
},
}