WhoIsSethDaniel/mason-tool-installer.nvim

Installation/Update complete event

Closed this issue ยท 5 comments

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?

Seems reasonable. I will see what I can do.

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",
    -- ...
}

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

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

@WhoIsSethDaniel thanks for adding that!