diff options
| author | William Boman <william@redwill.se> | 2026-01-07 14:39:35 +0100 |
|---|---|---|
| committer | William Boman <william@redwill.se> | 2026-01-07 14:39:35 +0100 |
| commit | ad903f1c1f18fd229d67e523418b3aa6c9f1c862 (patch) | |
| tree | d52cca80e062b3df9b8daeba20435aa83c34c7a2 /lua/mason-registry/init.lua | |
| parent | fix(installer): update cwd after uv_fs_rename() was successful (#2033) (diff) | |
| download | mason-fix/support-removed-packages.tar mason-fix/support-removed-packages.tar.gz mason-fix/support-removed-packages.tar.bz2 mason-fix/support-removed-packages.tar.lz mason-fix/support-removed-packages.tar.xz mason-fix/support-removed-packages.tar.zst mason-fix/support-removed-packages.zip | |
feat: add support for removal of packages from a registryfix/support-removed-packages
This adds support for removal of packages from any given registry.
Currently mason.nvim doesn't support this at all and throws an error
when trying to interact with the registry in any way while having a
removed package installed locally.
This ensures that removed packages are available both in the `:Mason` UI
as well as the public Lua APIs. These "synthesized" packages only
supports uninstallation, and metadata such as licenses, categories,
homepage, etc is not available.
Diffstat (limited to 'lua/mason-registry/init.lua')
| -rw-r--r-- | lua/mason-registry/init.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lua/mason-registry/init.lua b/lua/mason-registry/init.lua index 535e6b57..5806c30a 100644 --- a/lua/mason-registry/init.lua +++ b/lua/mason-registry/init.lua @@ -49,7 +49,6 @@ function Registry.get_installed_package_names() directories[#directories + 1] = entry.name end end - -- TODO: validate that entry is a mason package return directories end @@ -68,7 +67,10 @@ function Registry.get_all_package_names() end function Registry.get_all_packages() - return vim.tbl_map(Registry.get_package, Registry.get_all_package_names()) + local _ = require "mason-core.functional" + local packages = + _.uniq_by(_.identity, _.concat(Registry.get_all_package_names(), Registry.get_installed_package_names())) + return vim.tbl_map(Registry.get_package, packages) end function Registry.get_all_package_specs() |
