aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-core/package/AbstractPackage.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2026-05-14 17:21:42 +0200
committerGitHub <noreply@github.com>2026-05-14 17:21:42 +0200
commit8e921c2b68571e978db5d4d3fef9c9a7f8755473 (patch)
treec16d4b5c8a6e33877c523d2e7ff714090432a8de /lua/mason-core/package/AbstractPackage.lua
parentfix(pypi): add python 3.13 and 3.14 to list of fallbacks (#2081) (diff)
downloadmason-8e921c2b68571e978db5d4d3fef9c9a7f8755473.tar
mason-8e921c2b68571e978db5d4d3fef9c9a7f8755473.tar.gz
mason-8e921c2b68571e978db5d4d3fef9c9a7f8755473.tar.bz2
mason-8e921c2b68571e978db5d4d3fef9c9a7f8755473.tar.lz
mason-8e921c2b68571e978db5d4d3fef9c9a7f8755473.tar.xz
mason-8e921c2b68571e978db5d4d3fef9c9a7f8755473.tar.zst
mason-8e921c2b68571e978db5d4d3fef9c9a7f8755473.zip
feat: add the infrastructure to support "system" packages (#2085)HEADmain
This enables `mason.nvim` to start managing certain packages that: 1) are not suitable for the core registry 2) should not surface in existing APIs and UIs
Diffstat (limited to 'lua/mason-core/package/AbstractPackage.lua')
-rw-r--r--lua/mason-core/package/AbstractPackage.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/lua/mason-core/package/AbstractPackage.lua b/lua/mason-core/package/AbstractPackage.lua
index 5678f4dd..a852d350 100644
--- a/lua/mason-core/package/AbstractPackage.lua
+++ b/lua/mason-core/package/AbstractPackage.lua
@@ -6,6 +6,7 @@ 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
@@ -128,7 +129,7 @@ end
---@return Optional # Optional<InstallReceipt>
function AbstractPackage:get_receipt(location)
location = location or InstallLocation.global()
- local receipt_path = location:receipt(self.name)
+ local receipt_path = self:get_receipt_path(location)
if fs.sync.file_exists(receipt_path) then
local receipt = require "mason-core.receipt"
return Optional.of(receipt.InstallReceipt.from_json(vim.json.decode(fs.sync.read_file(receipt_path))))
@@ -137,6 +138,11 @@ function AbstractPackage:get_receipt(location)
end
---@param location? InstallLocation
+function AbstractPackage:get_receipt_path(location)
+ return path.concat { self:get_install_path(location), "mason-receipt.json" }
+end
+
+---@param location? InstallLocation
---@return boolean
function AbstractPackage:is_installed(location)
error "Unimplemented."
@@ -174,6 +180,11 @@ function AbstractPackage:get_installed_version(location)
:or_else(nil)
end
+---@param location? InstallLocation
+function AbstractPackage:get_install_path(location)
+ error "Unimplemented."
+end
+
---@param opts? PackageInstallOpts
---@param callback? InstallRunnerCallback
---@return InstallHandle