Skip to content

Commit

Permalink
feat(vue): configure volar as tsserver plugin (#1007)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielscaranello authored May 30, 2024
1 parent b45874f commit 4b149f1
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lua/astrocommunity/pack/vue/init.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
return {
{ import = "astrocommunity.pack.typescript" },
{
"AstroNvim/astrolsp",
optional = true,
Expand Down Expand Up @@ -37,6 +38,33 @@ return {
},
},
},
vtsls = {
settings = {
vtsls = {
tsserver = {
globalPlugins = {},
},
},
},
before_init = function(_, config)
local astrocore_ok, astrocore = pcall(require, "astrocore")
local registry_ok, registry = pcall(require, "mason-registry")
if not astrocore_ok or not registry_ok then return end

local volar_install_path = registry.get_package("vue-language-server"):get_install_path()
.. "/node_modules/@vue/language-server"

local vue_plugin_config = {
name = "@vue/typescript-plugin",
location = volar_install_path,
languages = { "vue" },
configNamespace = "typescript",
enableForWorkspaceTypeScriptVersions = true,
}

astrocore.list_insert_unique(config.settings.vtsls.tsserver.globalPlugins, { vue_plugin_config })
end,
},
},
},
},
Expand Down

0 comments on commit 4b149f1

Please sign in to comment.