diff options
| author | William Boman <william@redwill.se> | 2023-02-20 22:19:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-20 22:19:39 +0100 |
| commit | b8a6632a0f2d263199d5d480ca85477fe0f414ab (patch) | |
| tree | 57e1ee0f3cef078ec144ecdf1b2fa861acf47755 /lua/mason-registry/index/haskell-language-server/init.lua | |
| parent | chore: autogenerate (#1015) (diff) | |
| download | mason-b8a6632a0f2d263199d5d480ca85477fe0f414ab.tar mason-b8a6632a0f2d263199d5d480ca85477fe0f414ab.tar.gz mason-b8a6632a0f2d263199d5d480ca85477fe0f414ab.tar.bz2 mason-b8a6632a0f2d263199d5d480ca85477fe0f414ab.tar.lz mason-b8a6632a0f2d263199d5d480ca85477fe0f414ab.tar.xz mason-b8a6632a0f2d263199d5d480ca85477fe0f414ab.tar.zst mason-b8a6632a0f2d263199d5d480ca85477fe0f414ab.zip | |
feat: configurable registries (#1016)
Diffstat (limited to 'lua/mason-registry/index/haskell-language-server/init.lua')
| -rw-r--r-- | lua/mason-registry/index/haskell-language-server/init.lua | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/lua/mason-registry/index/haskell-language-server/init.lua b/lua/mason-registry/index/haskell-language-server/init.lua new file mode 100644 index 00000000..8f0e3d42 --- /dev/null +++ b/lua/mason-registry/index/haskell-language-server/init.lua @@ -0,0 +1,55 @@ +local a = require "mason-core.async" +local _ = require "mason-core.functional" +local Pkg = require "mason-core.package" +local std = require "mason-core.managers.std" +local github = require "mason-core.managers.github" +local path = require "mason-core.path" +local platform = require "mason-core.platform" + +return Pkg.new { + name = "haskell-language-server", + desc = [[Official Haskell Language Server implementation.]], + homepage = "https://haskell-language-server.readthedocs.io/en/latest/", + languages = { Pkg.Lang.Haskell }, + categories = { Pkg.Cat.LSP }, + ---@async + ---@param ctx InstallContext + install = function(ctx) + local source = github.release_version { repo = "haskell/haskell-language-server" } + source.with_receipt() + + std.ensure_executable("ghcup", { help_url = "https://www.haskell.org/ghcup/" }) + ctx:promote_cwd() + ctx.spawn.ghcup { "install", "hls", source.release, "-i", ctx.cwd:get() } + + platform.when { + unix = function() + ctx:link_bin( + "haskell-language-server-wrapper", + path.concat { "bin", "haskell-language-server-wrapper" } + ) + + a.scheduler() + for _, executable_abs_path in + ipairs( + vim.fn.glob(path.concat { ctx.cwd:get(), "bin", "haskell-language-server-[0-9]*" }, true, true) + ) + do + local executable = vim.fn.fnamemodify(executable_abs_path, ":t") + ctx:link_bin(executable, path.concat { "bin", executable }) + end + end, + win = function() + ctx:link_bin("haskell-language-server-wrapper", "haskell-language-server-wrapper.exe") + + a.scheduler() + for _, executable_abs_path in + ipairs(vim.fn.glob(path.concat { ctx.cwd:get(), "haskell-language-server-[0-9]*" }, true, true)) + do + local executable = vim.fn.fnamemodify(executable_abs_path, ":t:r") + ctx:link_bin(executable, ("%s.exe"):format(executable)) + end + end, + } + end, +} |
