aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-registry/sources/github.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2023-10-13 21:14:29 +0200
committerWilliam Boman <william@redwill.se>2025-02-19 09:23:19 +0100
commitae208dc380808ff1aef39929a0e897e881571d43 (patch)
treeb9044cec7223062db69998189c76f8163ac9d58b /lua/mason-registry/sources/github.lua
parentfix(location): use correct registry path (diff)
downloadmason-ae208dc380808ff1aef39929a0e897e881571d43.tar
mason-ae208dc380808ff1aef39929a0e897e881571d43.tar.gz
mason-ae208dc380808ff1aef39929a0e897e881571d43.tar.bz2
mason-ae208dc380808ff1aef39929a0e897e881571d43.tar.lz
mason-ae208dc380808ff1aef39929a0e897e881571d43.tar.xz
mason-ae208dc380808ff1aef39929a0e897e881571d43.tar.zst
mason-ae208dc380808ff1aef39929a0e897e881571d43.zip
refactor: standardize constructors and improve inheritance construction
Diffstat (limited to 'lua/mason-registry/sources/github.lua')
-rw-r--r--lua/mason-registry/sources/github.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/lua/mason-registry/sources/github.lua b/lua/mason-registry/sources/github.lua
index 81ccaf56..d0a782fb 100644
--- a/lua/mason-registry/sources/github.lua
+++ b/lua/mason-registry/sources/github.lua
@@ -31,15 +31,17 @@ local GitHubRegistrySource = {}
GitHubRegistrySource.__index = GitHubRegistrySource
---@param spec GitHubRegistrySourceSpec
-function GitHubRegistrySource.new(spec)
+function GitHubRegistrySource:new(spec)
+ ---@type GitHubRegistrySource
+ local instance = {}
+ setmetatable(instance, GitHubRegistrySource)
local root_dir = InstallLocation.global():registry(path.concat { "github", spec.namespace, spec.name })
- return setmetatable({
- id = spec.id,
- spec = spec,
- root_dir = root_dir,
- data_file = path.concat { root_dir, "registry.json" },
- info_file = path.concat { root_dir, "info.json" },
- }, GitHubRegistrySource)
+ instance.id = spec.id
+ instance.spec = spec
+ instance.root_dir = root_dir
+ instance.data_file = path.concat { root_dir, "registry.json" }
+ instance.info_file = path.concat { root_dir, "info.json" }
+ return instance
end
function GitHubRegistrySource:is_installed()