From f4490252fb2262208923ba197eb521732a602ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=B5=20Quang=20Chi=E1=BA=BFn?= <87252943+2giosangmitom@users.noreply.github.com> Date: Mon, 13 May 2024 03:10:32 +0700 Subject: [PATCH] feat(vue): add Vue.js support to LazyVim (#3094) --- lua/lazyvim/plugins/extras/lang/vue.lua | 46 +++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/vue.lua diff --git a/lua/lazyvim/plugins/extras/lang/vue.lua b/lua/lazyvim/plugins/extras/lang/vue.lua new file mode 100644 index 00000000..a943874b --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/vue.lua @@ -0,0 +1,46 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "vue" }) + end + end, + }, + + { + "neovim/nvim-lspconfig", + opts = function(_, opts) + local vue_typescript_plugin = require("mason-registry").get_package("vue-language-server"):get_install_path() + .. "/node_modules/@vue/language-server" + .. "/node_modules/@vue/typescript-plugin" + + opts.servers = vim.tbl_deep_extend("force", opts.servers, { + volar = {}, + -- Volar 2.0 has discontinued their "take over mode" which in previous version provided support for typescript in vue files. + -- The new approach to get typescript support involves using the typescript language server along side volar. + tsserver = { + init_options = { + plugins = { + -- Use typescript language server along with vue typescript plugin + { + name = "@vue/typescript-plugin", + location = vue_typescript_plugin, + languages = { "javascript", "typescript", "vue" }, + }, + }, + }, + filetypes = { + "javascript", + "javascriptreact", + "javascript.jsx", + "typescript", + "typescriptreact", + "typescript.tsx", + "vue", + }, + }, + }) + end, + }, +}