mason-tool-installer.nvim icon indicating copy to clipboard operation
mason-tool-installer.nvim copied to clipboard

Installation/Update complete event

Open kassio opened this issue 3 years ago • 1 comments
trafficstars

I update my tools very frequently with some scripts. I think would be nice to have an event that the user could attach an action for when the installations/updating is complete. Something similar to what packer does: https://github.com/wbthomason/packer.nvim#user-autocommands

This way I could nest all the package/toolings update and then quit neovim, like:

nvim --headless \
  -c 'autocmd User PackerComplete MasonToolsUpdate' \
  -c 'autocmd User MasonToolsComplete quitall!' \
  -c 'PackerSync'

What do you think?

kassio avatar Jul 28 '22 17:07 kassio

Seems reasonable. I will see what I can do.

WhoIsSethDaniel avatar Jul 28 '22 18:07 WhoIsSethDaniel

FWIW, Mason runs installation in blocking fashion when there are no UIs attached (i.e. headless). @WhoIsSethDaniel if you'd like you could probably leverage this by calling into:

local mason_command_api = require("mason.api.command")

mason_command_api.MasonInstall {
    "package-one",
    "package-two@with-pin",
    -- ...
}

williamboman avatar Aug 05 '22 23:08 williamboman

I think I'd like the event to be triggered regardless of headless mode or not.

WhoIsSethDaniel avatar Aug 06 '22 00:08 WhoIsSethDaniel

#10 is intended to fix this issue. Please let me know and/or close out the bug. Thanks.

WhoIsSethDaniel avatar Sep 02 '22 00:09 WhoIsSethDaniel

@WhoIsSethDaniel thanks for adding that!

kassio avatar Sep 02 '22 12:09 kassio