diff options
| author | William Boman <william@redwill.se> | 2026-01-07 15:46:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-07 15:46:58 +0100 |
| commit | 69862d6c8dbe215489c3e48e624ff25f44437e55 (patch) | |
| tree | d52cca80e062b3df9b8daeba20435aa83c34c7a2 /lua/mason-core/package/AbstractPackage.lua | |
| parent | fix(installer): update cwd after uv_fs_rename() was successful (#2033) (diff) | |
| download | mason-69862d6c8dbe215489c3e48e624ff25f44437e55.tar mason-69862d6c8dbe215489c3e48e624ff25f44437e55.tar.gz mason-69862d6c8dbe215489c3e48e624ff25f44437e55.tar.bz2 mason-69862d6c8dbe215489c3e48e624ff25f44437e55.tar.lz mason-69862d6c8dbe215489c3e48e624ff25f44437e55.tar.xz mason-69862d6c8dbe215489c3e48e624ff25f44437e55.tar.zst mason-69862d6c8dbe215489c3e48e624ff25f44437e55.zip | |
feat: add support for removal of packages from a registry (#2052)
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-core/package/AbstractPackage.lua')
| -rw-r--r-- | lua/mason-core/package/AbstractPackage.lua | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lua/mason-core/package/AbstractPackage.lua b/lua/mason-core/package/AbstractPackage.lua index d0fde00d..5678f4dd 100644 --- a/lua/mason-core/package/AbstractPackage.lua +++ b/lua/mason-core/package/AbstractPackage.lua @@ -6,7 +6,6 @@ local Result = require "mason-core.result" local _ = require "mason-core.functional" local fs = require "mason-core.fs" local log = require "mason-core.log" -local path = require "mason-core.path" local settings = require "mason.settings" local Semaphore = require("mason-core.async.control").Semaphore @@ -166,15 +165,10 @@ end ---@return string? function AbstractPackage:get_installed_version(location) return self:get_receipt(location) - :and_then( + :map( ---@param receipt InstallReceipt function(receipt) - local source = receipt:get_source() - if source.id then - return Purl.parse(source.id):map(_.prop "version"):ok() - else - return Optional.empty() - end + return receipt:get_installed_package_version() end ) :or_else(nil) |
