[mirror] Make your go dev experience better github.com/olexsmir/gopher.nvim
neovim golang

fix: add separate timeout for instalelr (#109)

* fix(installer): add separate timeout for installer

authored by olexsmir.xyz and committed by GitHub 9d28cdeb ea28fc4e

Changed files
+19 -5
doc
lua
+3
doc/gopher.nvim.txt
··· 57 57 ---@type number 58 58 timeout = 2000, 59 59 60 + --- timeout for running installer commands(e.g :GoDepsInstall, :GoDepsInstallSync) 61 + installer_timeout = 999999, 62 + 60 63 -- user specified paths to binaries 61 64 ---@class gopher.ConfigCommand 62 65 commands = {
+1 -1
lua/gopher/_utils/init.lua
··· 3 3 local utils = {} 4 4 5 5 ---@param msg string 6 - ---@param lvl? number 6 + ---@param lvl? number by default `vim.log.levels.INFO` 7 7 function utils.notify(msg, lvl) 8 8 lvl = lvl or vim.log.levels.INFO 9 9 vim.notify(msg, lvl, {
+3
lua/gopher/config.lua
··· 25 25 ---@type number 26 26 timeout = 2000, 27 27 28 + --- timeout for running installer commands(e.g :GoDepsInstall, :GoDepsInstallSync) 29 + installer_timeout = 999999, 30 + 28 31 -- user specified paths to binaries 29 32 ---@class gopher.ConfigCommand 30 33 commands = {
+12 -4
lua/gopher/installer.lua
··· 1 - local c = require("gopher.config").commands 1 + local c = require "gopher.config" 2 2 local r = require "gopher._utils.runner" 3 3 local u = require "gopher._utils" 4 4 local log = require "gopher._utils.log" ··· 30 30 31 31 ---@param url string 32 32 local function install(url) 33 - r.async({ c.go, "install", url }, function(opt) 33 + vim.schedule(function() 34 + u.notify("go install-ing: " .. url) 35 + end) 36 + 37 + r.async({ c.commands.go, "install", url }, function(opt) 34 38 handle_intall_exit(opt, url) 35 - end) 39 + end, { timeout = c.installer_timeout }) 36 40 end 37 41 38 42 ---@param url string 39 43 local function install_sync(url) 40 - local rs = r.sync { c.go, "install", url } 44 + vim.schedule(function() 45 + u.notify("go install-ing: " .. url) 46 + end) 47 + 48 + local rs = r.sync({ c.commands.go, "install", url }, { timeout = c.installer_timeout }) 41 49 handle_intall_exit(rs, url) 42 50 end 43 51