-
-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: more notify() messages when auto installing servers (#131)
- Loading branch information
1 parent
f3f2b58
commit 610f591
Showing
6 changed files
with
111 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
local notify = require "mason-core.notify" | ||
local server_mapping = require "mason-lspconfig.mappings.server" | ||
|
||
local M = {} | ||
|
||
---@param pkg Package | ||
---@param version string? | ||
---@return InstallHandle | ||
function M.install(pkg, version) | ||
local lspconfig_name = server_mapping.package_to_lspconfig[pkg.name] | ||
notify(("[mason-lspconfig.nvim] installing %s"):format(lspconfig_name)) | ||
return pkg:install({ version = version }):once( | ||
"closed", | ||
vim.schedule_wrap(function() | ||
if pkg:is_installed() then | ||
notify(("[mason-lspconfig.nvim] %s was successfully installed"):format(lspconfig_name)) | ||
else | ||
notify( | ||
("[mason-lspconfig.nvim] failed to install %s. Installation logs are available in :Mason and :MasonLog"):format( | ||
lspconfig_name | ||
), | ||
vim.log.levels.ERROR | ||
) | ||
end | ||
end) | ||
) | ||
end | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
local Pkg = require "mason-core.package" | ||
|
||
return Pkg.new { | ||
name = "fail_dummy", | ||
desc = [[This is a dummy package that fails.]], | ||
categories = { Pkg.Cat.LSP }, | ||
languages = { Pkg.Lang.DummyLang }, | ||
homepage = "https://example.com", | ||
install = function() | ||
error("fail-dummy doesn't want to be installed", 0) | ||
end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters