mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-24 17:58:51 +02:00
feat(astro): added support for ts-plugin, but won't work till mason-registry PR is merged. See #3364
This commit is contained in:
parent
9d999fa210
commit
683aaeb75b
2 changed files with 27 additions and 2 deletions
|
@ -10,6 +10,9 @@ return {
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
-- depends on the typescript extra
|
||||||
|
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||||
|
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
|
@ -19,6 +22,7 @@ return {
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- LSP Servers
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
opts = {
|
opts = {
|
||||||
|
@ -27,4 +31,22 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- Configure tsserver plugin
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = function(_, opts)
|
||||||
|
LazyVim.extend(opts.servers.vtsls, "settings.vtsls.tsserver.globalPlugins", {
|
||||||
|
{
|
||||||
|
name = "@astrojs/ts-plugin",
|
||||||
|
location = LazyVim.get_pkg_path(
|
||||||
|
"astro-language-server",
|
||||||
|
"/node_modules/@astrojs/ts-plugin",
|
||||||
|
{ warn = false }
|
||||||
|
),
|
||||||
|
enableForWorkspaceTypeScriptVersions = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,10 +221,13 @@ end
|
||||||
--- available yet and trigger errors.
|
--- available yet and trigger errors.
|
||||||
---@param pkg string
|
---@param pkg string
|
||||||
---@param path? string
|
---@param path? string
|
||||||
function M.get_pkg_path(pkg, path)
|
---@param opts? { warn?: boolean }
|
||||||
|
function M.get_pkg_path(pkg, path, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.warn = opts.warn == nil and true or opts.warn
|
||||||
path = path or ""
|
path = path or ""
|
||||||
local ret = vim.env.MASON .. "/packages/" .. pkg .. "/" .. path
|
local ret = vim.env.MASON .. "/packages/" .. pkg .. "/" .. path
|
||||||
if not vim.loop.fs_stat(ret) then
|
if opts.warn and not vim.loop.fs_stat(ret) then
|
||||||
M.warn(("Mason package path not found for **%s**:\n- `%s`"):format(pkg, path))
|
M.warn(("Mason package path not found for **%s**:\n- `%s`"):format(pkg, path))
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue