aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-10-29 19:26:49 +0200
committerGitHub <noreply@github.com>2021-10-29 19:26:49 +0200
commitb7c821c1e38ad7f52195186b0f5d17a6d64a55aa (patch)
treefd8789919803e8d8d253e3dd5108ac7d82bdc478 /lua
parentfix gathering currently open filetypes (diff)
downloadmason-b7c821c1e38ad7f52195186b0f5d17a6d64a55aa.tar
mason-b7c821c1e38ad7f52195186b0f5d17a6d64a55aa.tar.gz
mason-b7c821c1e38ad7f52195186b0f5d17a6d64a55aa.tar.bz2
mason-b7c821c1e38ad7f52195186b0f5d17a6d64a55aa.tar.lz
mason-b7c821c1e38ad7f52195186b0f5d17a6d64a55aa.tar.xz
mason-b7c821c1e38ad7f52195186b0f5d17a6d64a55aa.tar.zst
mason-b7c821c1e38ad7f52195186b0f5d17a6d64a55aa.zip
add public API to close installer window (#208)
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-lsp-installer.lua17
-rw-r--r--lua/nvim-lsp-installer/installers/context.lua2
-rw-r--r--lua/nvim-lsp-installer/ui/status-win/init.lua9
3 files changed, 25 insertions, 3 deletions
diff --git a/lua/nvim-lsp-installer.lua b/lua/nvim-lsp-installer.lua
index 5253e654..d1ab5f20 100644
--- a/lua/nvim-lsp-installer.lua
+++ b/lua/nvim-lsp-installer.lua
@@ -12,8 +12,23 @@ local M = {}
M.settings = settings.set
---- Opens the status window.
+M.info_window = {
+ ---Opens the status window.
+ open = function()
+ status_win().open()
+ end,
+ ---Closes the status window.
+ close = function()
+ status_win().close()
+ end,
+}
+
+---Deprecated. Use info_window.open().
function M.display()
+ notify(
+ "The lsp_installer.display() function has been deprecated. Use lsp_installer.info_window.open() instead.",
+ vim.log.levels.WARN
+ )
status_win().open()
end
diff --git a/lua/nvim-lsp-installer/installers/context.lua b/lua/nvim-lsp-installer/installers/context.lua
index b5be573f..71f2f991 100644
--- a/lua/nvim-lsp-installer/installers/context.lua
+++ b/lua/nvim-lsp-installer/installers/context.lua
@@ -89,7 +89,7 @@ function M.use_github_release(repo)
end
---@param repo string @The GitHub report ("username/repo").
----@param file string @The name of a file availabine in the provided repo's GitHub releases.
+---@param file string|fun(resolved_version: string): string @The name of a file available in the provided repo's GitHub releases.
function M.use_github_release_file(repo, file)
return installers.pipe {
M.use_github_release(repo),
diff --git a/lua/nvim-lsp-installer/ui/status-win/init.lua b/lua/nvim-lsp-installer/ui/status-win/init.lua
index 887f6df1..d08536b6 100644
--- a/lua/nvim-lsp-installer/ui/status-win/init.lua
+++ b/lua/nvim-lsp-installer/ui/status-win/init.lua
@@ -729,6 +729,12 @@ local function init(all_servers)
start_delay_ms = 1000,
}
+ local function close()
+ if window then
+ window.close()
+ end
+ end
+
local function open()
local open_filetypes = {}
for _, open_bufnr in ipairs(vim.api.nvim_list_bufs()) do
@@ -774,7 +780,7 @@ local function init(all_servers)
end)
end,
["CLOSE_WINDOW"] = function()
- window.close()
+ close()
end,
["TOGGLE_EXPAND_CURRENT_SETTINGS"] = function()
mutate_state(function(state)
@@ -814,6 +820,7 @@ local function init(all_servers)
return {
open = open,
+ close = close,
install_server = install_server,
uninstall_server = uninstall_server,
mark_all_servers_uninstalled = mark_all_servers_uninstalled,