aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-core/installer/compiler
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2025-02-16 17:07:22 +0100
committerWilliam Boman <william@redwill.se>2025-02-19 12:15:49 +0100
commit5063ba98dc220a754caf68e510fb192755b1bdf0 (patch)
tree174abf2bd4339e3ea1db3652610469f3f09e24b2 /lua/mason-core/installer/compiler
parentfeat(context): add ctx:fetch() (diff)
downloadmason-5063ba98dc220a754caf68e510fb192755b1bdf0.tar
mason-5063ba98dc220a754caf68e510fb192755b1bdf0.tar.gz
mason-5063ba98dc220a754caf68e510fb192755b1bdf0.tar.bz2
mason-5063ba98dc220a754caf68e510fb192755b1bdf0.tar.lz
mason-5063ba98dc220a754caf68e510fb192755b1bdf0.tar.xz
mason-5063ba98dc220a754caf68e510fb192755b1bdf0.tar.zst
mason-5063ba98dc220a754caf68e510fb192755b1bdf0.zip
refactor: turn StdioSink into a proper class
Diffstat (limited to 'lua/mason-core/installer/compiler')
-rw-r--r--lua/mason-core/installer/compiler/schemas.lua4
-rw-r--r--lua/mason-core/installer/compiler/util.lua10
2 files changed, 7 insertions, 7 deletions
diff --git a/lua/mason-core/installer/compiler/schemas.lua b/lua/mason-core/installer/compiler/schemas.lua
index 5e578dbd..889a2ad9 100644
--- a/lua/mason-core/installer/compiler/schemas.lua
+++ b/lua/mason-core/installer/compiler/schemas.lua
@@ -20,7 +20,7 @@ local function download_lsp_schema(ctx, url)
if is_vscode_schema then
local url = unpack(_.match("^vscode:(.+)$", url))
- ctx.stdio_sink.stdout(("Downloading LSP configuration schema from %q…\n"):format(url))
+ ctx.stdio_sink:stdout(("Downloading LSP configuration schema from %q…\n"):format(url))
local json = try(fetch(url))
---@type { contributes?: { configuration?: table } }
@@ -34,7 +34,7 @@ local function download_lsp_schema(ctx, url)
return Result.failure "Unable to find LSP entry in VSCode schema."
end
else
- ctx.stdio_sink.stdout(("Downloading LSP configuration schema from %q…\n"):format(url))
+ ctx.stdio_sink:stdout(("Downloading LSP configuration schema from %q…\n"):format(url))
try(std.download_file(url, out_file))
ctx.links.share[share_file] = out_file
end
diff --git a/lua/mason-core/installer/compiler/util.lua b/lua/mason-core/installer/compiler/util.lua
index b3735c9c..c244cca8 100644
--- a/lua/mason-core/installer/compiler/util.lua
+++ b/lua/mason-core/installer/compiler/util.lua
@@ -44,7 +44,7 @@ function M.ensure_valid_version(versions_thunk)
local version = ctx.opts.version
if version and not ctx.opts.force then
- ctx.stdio_sink.stdout "Fetching available versions…\n"
+ ctx.stdio_sink:stdout "Fetching available versions…\n"
local all_versions = versions_thunk()
if all_versions:is_failure() then
log.warn("Failed to fetch versions for package", ctx.package)
@@ -54,10 +54,10 @@ function M.ensure_valid_version(versions_thunk)
all_versions = all_versions:get_or_else {}
if not _.any(_.equals(version), all_versions) then
- ctx.stdio_sink.stderr(("Tried to install invalid version %q. Available versions:\n"):format(version))
- ctx.stdio_sink.stderr(_.compose(_.join "\n", _.map(_.join ", "), _.split_every(15))(all_versions))
- ctx.stdio_sink.stderr "\n\n"
- ctx.stdio_sink.stderr(
+ ctx.stdio_sink:stderr(("Tried to install invalid version %q. Available versions:\n"):format(version))
+ ctx.stdio_sink:stderr(_.compose(_.join "\n", _.map(_.join ", "), _.split_every(15))(all_versions))
+ ctx.stdio_sink:stderr "\n\n"
+ ctx.stdio_sink:stderr(
("Run with --force flag to bypass version validation:\n :MasonInstall --force %s@%s\n\n"):format(
ctx.package.name,
version