Closed alisonjenkins closed 2 years ago
All I can say is that it doesn't block for me. I can start editing right away while the tools are being installed (I see the updates in the messages).
I may need more information to help you.
You may try deactivating all plugins but mason and mason-tool-installer to see if that changes things.
I copied your mason-tool-installer
config to my own config and brought up nvim
. FWIW I had no problems. Most tools were installed (a few weren't because I was missing some prerequisites), but over several minutes it installed around 75 tools while I was doing my normal work within nvim
.
Another thing to try: limit your list of tools to 1, wipe the mason
install directory, and start nvim
. Once the one thing is installed type :messages
and cut and paste the entire output here. It may give some insight into what is going on. I'd try commenting out all plugins but mason
and mason-tool-installer
first...just to eliminate the possibility of interference of some sort with one of your other plugins.
@WhoIsSethDaniel thanks will give these things a go later once I finish work.
I'm seeing this as well. If I set auto_update = false
, the startup lag goes away.
is it lag or is it essentially blocking until all services are installed (I think this latter is what the initial report is saying)? Either way I find this baffling as I don't see either one. It also doesn't make much sense for auto_update
to affect installation since auto_update
only comes into effect when there are updates.
I have one idea that may fix this, but since I don't see the problem it's very difficult to say.
If I had to guess, I'd say blocking. I've not looked into it further though.
Running the installer code similar to the suggestions here for copilot.lua
might be a valid approach: https://github.com/zbirenbaum/copilot.lua
@dsully I'm already deferring until VimEnter, which is the first entry in the link you provide. VimEnter starts very late in the startup process. If it's truly blocking then it doesn't matter where you start it will block eventually.
How many items are you installing? The OP had around 75 tools that were being installed.
However I'm not doing a defer_fn()
. I don't see how that would help, but I can try it.
I went ahead and added a start_delay
option. It's documented in the README.md. By default it's 0, but if you set it to, say, 5000 it will delay starting installation for 5 seconds. This corresponds with the 1) option in the link you provided. Try different values, perhaps start with a very high value, like 8000 or 10000. See if it helps at all. If it doesn't a detailed report on what exactly happened would be appreciated.
require("mason").setup({
ui = {
border = "single",
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
},
},
})
require("mason-tool-installer").setup({
auto_update = true,
ensure_installed = {
-- LSP servers
"bash-language-server",
"clangd",
"cmake-language-server",
"css-lsp",
"dockerfile-language-server",
"gopls",
"graphql-language-service-cli",
"html-lsp",
"jdtls",
"json-lsp",
"kotlin-language-server",
"lua-language-server",
"pyright",
"python-lsp-server",
"rust-analyzer",
"taplo",
"teal-language-server",
"terraform-ls",
"typescript-language-server",
"yaml-language-server",
-- Linters
"actionlint",
"codespell",
"debugpy",
"eslint_d",
"flake8",
"gitlint",
"hadolint", -- Dockerfile
"markdownlint",
"mypy",
"selene",
"shellcheck",
"shellharden",
"yamllint",
-- Formatters
"black",
"gofumpt",
"golines",
"isort",
"prettierd",
"shfmt",
"stylua",
},
})
Is my setup.
Setting a 3 second delay removed the startup lag / blocking for me. Thanks!
Closing. The start_delay
has helped and there has been no feedback since.
Hey @WhoIsSethDaniel,
Love the plugin thanks for mentioning it in the issue. I have since set it up to install all my required tools but unfortunately it seems to have performance issues when installing lots of tools.
My configuration is here:
https://github.com/alanjjenkins/chezmoi-dotfiles/blob/master/private_dot_config/nvim/lua/plugins.lua https://github.com/alanjjenkins/chezmoi-dotfiles/blob/master/private_dot_config/nvim/lua/plugin-config/mason.lua https://github.com/alanjjenkins/chezmoi-dotfiles/blob/master/private_dot_config/nvim/lua/plugin-config/mason-tool-installer.lua
It seems like Neovim is blocking on startup waiting for Mason Tool Installer to install / update everything on every startup.
It seems this needs to be setup as a delayed async task to me (although you may already be doing this (I haven't read the code yet)). I believe this is possible using plenary.
Note that I might have commented my plugin block for this when you look at my plugins to restore the speed of startup (the lag when doing git commits is getting on my nerves).
Thanks,
Alan Jenkins