diff options
| author | William Boman <william@redwill.se> | 2022-04-21 12:09:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-21 12:09:59 +0200 |
| commit | b68fcc6bb2c770495ff8e2508c06dfdd49abcc80 (patch) | |
| tree | df7c71efb59958deb21a18eeccf3e3c43c4cd704 /lua/nvim-lsp-installer/servers/julials/init.lua | |
| parent | run autogen_metadata.lua (diff) | |
| download | mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.gz mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.bz2 mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.lz mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.xz mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.zst mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.zip | |
chore: refactor remaining installers to async impl (#616)
Diffstat (limited to 'lua/nvim-lsp-installer/servers/julials/init.lua')
| -rw-r--r-- | lua/nvim-lsp-installer/servers/julials/init.lua | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/lua/nvim-lsp-installer/servers/julials/init.lua b/lua/nvim-lsp-installer/servers/julials/init.lua index 690dd9d4..afbb16eb 100644 --- a/lua/nvim-lsp-installer/servers/julials/init.lua +++ b/lua/nvim-lsp-installer/servers/julials/init.lua @@ -1,7 +1,7 @@ local server = require "nvim-lsp-installer.server" local path = require "nvim-lsp-installer.path" -local context = require "nvim-lsp-installer.installers.context" -local std = require "nvim-lsp-installer.installers.std" +local std = require "nvim-lsp-installer.core.managers.std" +local github = require "nvim-lsp-installer.core.managers.github" return function(name, root_dir) local server_script = [[ @@ -26,31 +26,34 @@ runserver(stdin, root_dir = root_dir, homepage = "https://github.com/julia-vscode/LanguageServer.jl", languages = { "julia" }, - installer = { - std.ensure_executables { - { "julia", "julia was not found in path, refer to https://julialang.org/downloads/." }, - }, - context.use_github_release_file("julia-vscode/julia-vscode", function(version) - local version_number = version:gsub("^v", "") - return ("language-julia-%s.vsix"):format(version_number) - end), - context.capture(function(ctx) - return std.unzip_remote(ctx.github_release_file, "vscode-package") - end), - std.rename( + async = true, + ---@param ctx InstallContext + installer = function(ctx) + std.ensure_executable("julia", { help_url = "https://julialang.org/downloads/" }) + + ctx.fs:mkdir "vscode-package" + ctx:chdir("vscode-package", function() + github.unzip_release_file({ + repo = "julia-vscode/julia-vscode", + asset_file = function(version) + local version_number = version:gsub("^v", "") + return ("language-julia-%s.vsix"):format(version_number) + end, + }).with_receipt() + end) + + ctx.fs:rename( path.concat { "vscode-package", "extension", "scripts", }, "scripts" - ), - std.rmrf "vscode-package", - std.write_file("nvim-lsp.jl", server_script), - context.receipt(function(receipt, ctx) - receipt:with_primary_source(receipt.github_release_file(ctx)) - end), - }, + ) + ctx.fs:rmrf "vscode-package" + + ctx.fs:write_file("nvim-lsp.jl", server_script) + end, default_options = { cmd = { "julia", |
