aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-lsp-installer/dispatcher.lua8
-rw-r--r--lua/nvim-lsp-installer/path.lua2
-rw-r--r--lua/nvim-lsp-installer/ui/display.lua19
-rw-r--r--lua/nvim-lsp-installer/ui/status-win/init.lua1
4 files changed, 17 insertions, 13 deletions
diff --git a/lua/nvim-lsp-installer/dispatcher.lua b/lua/nvim-lsp-installer/dispatcher.lua
index 0ad41897..762da3e3 100644
--- a/lua/nvim-lsp-installer/dispatcher.lua
+++ b/lua/nvim-lsp-installer/dispatcher.lua
@@ -4,6 +4,7 @@ local M = {}
local registered_callbacks = {}
+---@param server Server
M.dispatch_server_ready = function(server)
for _, callback in pairs(registered_callbacks) do
local ok, err = pcall(callback, server)
@@ -13,12 +14,11 @@ M.dispatch_server_ready = function(server)
end
end
-local idx = 0
+---@param callback fun(server: Server)
function M.register_server_ready_callback(callback)
- local key = idx + 1
- registered_callbacks[("%d"):format(key)] = callback
+ registered_callbacks[callback] = callback
return function()
- table.remove(registered_callbacks, key)
+ registered_callbacks[callback] = nil
end
end
diff --git a/lua/nvim-lsp-installer/path.lua b/lua/nvim-lsp-installer/path.lua
index ed906954..533be48d 100644
--- a/lua/nvim-lsp-installer/path.lua
+++ b/lua/nvim-lsp-installer/path.lua
@@ -39,7 +39,7 @@ function M.realpath(relpath, depth)
end
function M.is_subdirectory(root_path, path)
- return path:sub(1, #root_path) == root_path
+ return root_path == path or path:sub(1, #root_path + 1) == root_path .. sep
end
return M
diff --git a/lua/nvim-lsp-installer/ui/display.lua b/lua/nvim-lsp-installer/ui/display.lua
index 43550222..889c3ac3 100644
--- a/lua/nvim-lsp-installer/ui/display.lua
+++ b/lua/nvim-lsp-installer/ui/display.lua
@@ -92,12 +92,14 @@ local function render_node(viewport_context, node, _render_context, _output)
local content, hl_group = span[1], span[2]
local col_start = #full_line
full_line = full_line .. content
- line_highlights[#line_highlights + 1] = {
- hl_group = hl_group,
- line = #output.lines,
- col_start = col_start,
- col_end = col_start + #content,
- }
+ if hl_group ~= "" then
+ line_highlights[#line_highlights + 1] = {
+ hl_group = hl_group,
+ line = #output.lines,
+ col_start = col_start,
+ col_end = col_start + #content,
+ }
+ end
end
local active_styles = get_styles(full_line, render_context)
@@ -135,6 +137,9 @@ local function render_node(viewport_context, node, _render_context, _output)
return output
end
+-- exported for tests
+M._render_node = render_node
+
local function create_popup_window_opts()
local win_height = vim.o.lines - vim.o.cmdheight - 2 -- Add margin for status and buffer line
local win_width = vim.o.columns
@@ -314,7 +319,7 @@ function M.new_view_only_win(name)
output.lines, output.virt_texts, output.highlights, output.keybinds
-- set line contents
- vim.api.nvim_buf_clear_namespace(0, namespace, 0, -1)
+ vim.api.nvim_buf_clear_namespace(bufnr, namespace, 0, -1)
vim.api.nvim_buf_set_option(bufnr, "modifiable", true)
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
vim.api.nvim_buf_set_option(bufnr, "modifiable", false)
diff --git a/lua/nvim-lsp-installer/ui/status-win/init.lua b/lua/nvim-lsp-installer/ui/status-win/init.lua
index 6adcf2ae..3191c6ae 100644
--- a/lua/nvim-lsp-installer/ui/status-win/init.lua
+++ b/lua/nvim-lsp-installer/ui/status-win/init.lua
@@ -769,7 +769,6 @@ local function init(all_servers)
end)
window.open {
- win_width = 95,
highlight_groups = {
"hi def LspInstallerHeader gui=bold guifg=#ebcb8b",
"hi def LspInstallerServerExpanded gui=italic",