diff options
| author | William Boman <william@redwill.se> | 2022-06-06 00:28:58 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-06 00:28:58 +0200 |
| commit | 1a9cdfe4d052dbfa16f3c12ce4def58a931b0730 (patch) | |
| tree | 62d69458bca3db1ee4b4b39de290e8ce3236ff11 | |
| parent | fix(platform): memoize .get_libc() ret val (#753) (diff) | |
| download | mason-1a9cdfe4d052dbfa16f3c12ce4def58a931b0730.tar mason-1a9cdfe4d052dbfa16f3c12ce4def58a931b0730.tar.gz mason-1a9cdfe4d052dbfa16f3c12ce4def58a931b0730.tar.bz2 mason-1a9cdfe4d052dbfa16f3c12ce4def58a931b0730.tar.lz mason-1a9cdfe4d052dbfa16f3c12ce4def58a931b0730.tar.xz mason-1a9cdfe4d052dbfa16f3c12ce4def58a931b0730.tar.zst mason-1a9cdfe4d052dbfa16f3c12ce4def58a931b0730.zip | |
feat(ui): add setting to customize window border (#754)
Closes #752.
| -rw-r--r-- | README.md | 3 | ||||
| -rw-r--r-- | doc/nvim-lsp-installer.txt | 3 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer.lua | 2 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/core/ui/display.lua | 11 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/settings.lua | 3 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/ui/init.lua | 1 |
6 files changed, 17 insertions, 6 deletions
@@ -335,6 +335,9 @@ local DEFAULT_SETTINGS = { -- Whether to automatically check for outdated servers when opening the UI window. check_outdated_servers_on_open = true, + -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|. + border = "none", + icons = { -- The list icon to use for installed servers. server_installed = "◍", diff --git a/doc/nvim-lsp-installer.txt b/doc/nvim-lsp-installer.txt index a2c2b01a..20ee2945 100644 --- a/doc/nvim-lsp-installer.txt +++ b/doc/nvim-lsp-installer.txt @@ -185,6 +185,9 @@ The following settings are applied by default. -- Whether to automatically check for outdated servers when opening the UI window. check_outdated_servers_on_open = true, + -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|. + border = "none", + icons = { -- The list icon to use for installed servers. server_installed = "◍", diff --git a/lua/nvim-lsp-installer.lua b/lua/nvim-lsp-installer.lua index 1643f3e8..5540369c 100644 --- a/lua/nvim-lsp-installer.lua +++ b/lua/nvim-lsp-installer.lua @@ -30,7 +30,7 @@ local function ensure_installed(server_identifiers) end end ----@param config table +---@param config LspInstallerSettings function M.setup(config) if config then settings.set(config) diff --git a/lua/nvim-lsp-installer/core/ui/display.lua b/lua/nvim-lsp-installer/core/ui/display.lua index b7c60c28..5e4618f5 100644 --- a/lua/nvim-lsp-installer/core/ui/display.lua +++ b/lua/nvim-lsp-installer/core/ui/display.lua @@ -141,8 +141,9 @@ end -- exported for tests M._render_node = render_node +---@param opts DisplayOpenOpts ---@param sizes_only boolean @Whether to only return properties that control the window size. -local function create_popup_window_opts(sizes_only) +local function create_popup_window_opts(opts, sizes_only) local win_height = vim.o.lines - vim.o.cmdheight - 2 -- Add margin for status and buffer line local win_width = vim.o.columns local height = math.floor(win_height * 0.9) @@ -158,7 +159,7 @@ local function create_popup_window_opts(sizes_only) } if not sizes_only then - popup_layout.border = "none" + popup_layout.border = opts.border end return popup_layout @@ -303,7 +304,7 @@ function M.new_view_only_win(name) opts = opts or {} local highlight_groups = opts.highlight_groups bufnr = vim.api.nvim_create_buf(false, true) - win_id = vim.api.nvim_open_win(bufnr, true, create_popup_window_opts(false)) + win_id = vim.api.nvim_open_win(bufnr, true, create_popup_window_opts(opts, false)) registered_effect_handlers = opts.effects registered_keybinds = {} @@ -352,7 +353,7 @@ function M.new_view_only_win(name) callback = function() if vim.api.nvim_win_is_valid(win_id) then draw(renderer(get_state())) - vim.api.nvim_win_set_config(win_id, create_popup_window_opts(true)) + vim.api.nvim_win_set_config(win_id, create_popup_window_opts(opts, true)) end end, }) @@ -419,7 +420,7 @@ function M.new_view_only_win(name) return mutate_state, get_state end, - ---@alias DisplayOpenOpts {effects: table<string, fun()>, highlight_groups: string[]|nil} + ---@alias DisplayOpenOpts {effects: table<string, fun()>, highlight_groups: string[]|nil, border: string|table} ---@type fun(opts: DisplayOpenOpts) open = vim.schedule_wrap(function(opts) log.trace "Opening window" diff --git a/lua/nvim-lsp-installer/settings.lua b/lua/nvim-lsp-installer/settings.lua index a0641480..d84b60af 100644 --- a/lua/nvim-lsp-installer/settings.lua +++ b/lua/nvim-lsp-installer/settings.lua @@ -21,6 +21,9 @@ local DEFAULT_SETTINGS = { -- Whether to automatically check for outdated servers when opening the UI window. check_outdated_servers_on_open = true, + -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|. + border = "none", + icons = { -- The list icon to use for installed servers. server_installed = "◍", diff --git a/lua/nvim-lsp-installer/ui/init.lua b/lua/nvim-lsp-installer/ui/init.lua index 32f420ac..fc063ff2 100644 --- a/lua/nvim-lsp-installer/ui/init.lua +++ b/lua/nvim-lsp-installer/ui/init.lua @@ -968,6 +968,7 @@ local function init(all_servers) end window.open { + border = settings.current.ui.border, highlight_groups = { "hi def LspInstallerHeader gui=bold guifg=#222222 guibg=#DCA561", "hi def LspInstallerHeaderHelp gui=bold guifg=#222222 guibg=#56B6C2", |
