feat(extras): custum the path of packages

This commit is contained in:
纳西妲 · Nahida 2024-08-22 02:01:03 +08:00
parent 12818a6cb4
commit 1f5c005c03
No known key found for this signature in database
GPG key ID: F6A3F09956C9F243
6 changed files with 52 additions and 7 deletions

View file

@ -1,3 +1,10 @@
if lazyvim_docs then
-- If you don't use Mason to install the `angular-language-server` you can use the following to custom path for `@angular/language-server`.
vim.g.pkg_path = {
["@angular/language-server"] = "path_to_this_node_package",
}
end
return {
recommended = function()
return LazyVim.extras.wants({
@ -51,7 +58,8 @@ return {
LazyVim.extend(opts.servers.vtsls, "settings.vtsls.tsserver.globalPlugins", {
{
name = "@angular/language-server",
location = LazyVim.get_pkg_path("angular-language-server", "/node_modules/@angular/language-server"),
location = vim.g.pkg_path and vim.g.pkg_path["@angular/language-server"]
or LazyVim.get_pkg_path("angular-language-server", "/node_modules/@angular/language-server"),
enableForWorkspaceTypeScriptVersions = false,
},
})

View file

@ -1,3 +1,10 @@
if lazyvim_docs then
-- If you don't use Mason to install the `astro-language-server` you can use the following to custom path for `@astrojs/ts-plugin`.
vim.g.pkg_path = {
["@astro/ts-plugin"] = "path_to_this_node_package",
}
end
return {
recommended = function()
return LazyVim.extras.wants({
@ -37,7 +44,8 @@ return {
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"),
location = vim.g.pkg_path and vim.g.pkg_path["@astro/ts-plugin"]
or LazyVim.get_pkg_path("astro-language-server", "/node_modules/@astrojs/ts-plugin"),
enableForWorkspaceTypeScriptVersions = true,
},
})

View file

@ -4,6 +4,10 @@ if lazyvim_docs then
vim.g.lazyvim_python_lsp = "pyright"
-- Set to "ruff_lsp" to use the old LSP implementation version.
vim.g.lazyvim_python_ruff = "ruff"
-- If you don't use Mason to install the `debugpy` you can use the following to custom path for `debugpy`.
vim.g.pkg_path = {
["debugpy"] = "path_to_this_package",
}
end
local lsp = vim.g.lazyvim_python_lsp or "pyright"
@ -103,10 +107,11 @@ return {
{ "<leader>dPc", function() require('dap-python').test_class() end, desc = "Debug Class", ft = "python" },
},
config = function()
local debugpy = vim.g.pkg_path and vim.g.pkg_path.debugpy
if vim.fn.has("win32") == 1 then
require("dap-python").setup(LazyVim.get_pkg_path("debugpy", "/venv/Scripts/pythonw.exe"))
require("dap-python").setup(debugpy or LazyVim.get_pkg_path("debugpy", "/venv/Scripts/pythonw.exe"))
else
require("dap-python").setup(LazyVim.get_pkg_path("debugpy", "/venv/bin/python"))
require("dap-python").setup(debugpy or LazyVim.get_pkg_path("debugpy", "/venv/bin/python"))
end
end,
},

View file

@ -1,3 +1,10 @@
if lazyvim_docs then
-- If you don't use Mason to install the `svelte-language-server` you can use the following to custom path for `svelte-language-server`.
vim.g.pkg_path = {
["svelte-language-server"] = "path_to_this_node_package",
}
end
return {
recommended = function()
return LazyVim.extras.wants({
@ -48,7 +55,8 @@ return {
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"),
location = vim.g.pkg_path and vim.g.pkg_path["typescript-svelte-plugin"]
or LazyVim.get_pkg_path("svelte-language-server", "/node_modules/typescript-svelte-plugin"),
enableForWorkspaceTypeScriptVersions = true,
},
})

View file

@ -1,3 +1,10 @@
if lazyvim_docs then
-- If you don't use Mason to install the `js-debug-adapter` you can use the following to custom path for `js-debug-adapter`.
vim.g.pkg_path = {
["js-debug-adapter"] = "path_to_this_node_package",
}
end
return {
recommended = function()
return LazyVim.extras.wants({
@ -200,7 +207,8 @@ return {
command = "node",
-- 💀 Make sure to update this path to point to your installation
args = {
LazyVim.get_pkg_path("js-debug-adapter", "/js-debug/src/dapDebugServer.js"),
vim.g.pkg_path and vim.g.pkg_path["js-debug-adapter"]
or LazyVim.get_pkg_path("js-debug-adapter", "/js-debug/src/dapDebugServer.js"),
"${port}",
},
},

View file

@ -1,3 +1,10 @@
if lazyvim_docs then
-- If you don't use Mason to install the `vue-language-server` you can use the following to custom path for `@vue/language-server`.
vim.g.pkg_path = {
["@vue/language-server"] = "path_to_this_node_package",
}
end
return {
recommended = function()
return LazyVim.extras.wants({
@ -39,7 +46,8 @@ return {
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"),
location = vim.g.pkg_path and vim.g.pkg_path["@vue/language-server"]
or LazyVim.get_pkg_path("vue-language-server", "/node_modules/@vue/language-server"),
languages = { "vue" },
configNamespace = "typescript",
enableForWorkspaceTypeScriptVersions = true,