Files
LazyVim/lua/lazyvim/plugins/extras/lang/vue.lua
bilabila 627215a72b fix(vue): ensure css treesitter installed (#4308)
## Description

If css treesitter is not installed(the current), <style> in vue file
will use wrong commentstring, ts-comments.nvim or
nvim-ts-context-commentstring both. so ensure it's installed.

## Related Issue(s)

explained: [in
https://github.com/JoosepAlviste/nvim-ts-context-commentstring/issues/117](https://github.com/JoosepAlviste/nvim-ts-context-commentstring/issues/117#issuecomment-2287909324)
close https://github.com/LazyVim/LazyVim/issues/4292
2024-09-18 08:22:05 +02:00

51 lines
1.1 KiB
Lua

return {
recommended = function()
return LazyVim.extras.wants({
ft = "vue",
root = { "vue.config.js" },
})
end,
-- depends on the typescript extra
{ import = "lazyvim.plugins.extras.lang.typescript" },
{
"nvim-treesitter/nvim-treesitter",
opts = { ensure_installed = { "vue", "css" } },
},
-- Add LSP servers
{
"neovim/nvim-lspconfig",
opts = {
servers = {
volar = {
init_options = {
vue = {
hybridMode = true,
},
},
},
vtsls = {},
},
},
},
-- Configure tsserver plugin
{
"neovim/nvim-lspconfig",
opts = function(_, opts)
table.insert(opts.servers.vtsls.filetypes, "vue")
LazyVim.extend(opts.servers.vtsls, "settings.vtsls.tsserver.globalPlugins", {
{
name = "@vue/typescript-plugin",
location = LazyVim.get_pkg_path("vue-language-server", "/node_modules/@vue/language-server"),
languages = { "vue" },
configNamespace = "typescript",
enableForWorkspaceTypeScriptVersions = true,
},
})
end,
},
}