feat(pack): hint in confirmation buffer that plugin is not active

Problem: After `vim.pack.update()` it is not clear if plugin is active
  or not. This can be useful to detect cases when plugin was removed
  from 'init.lua' but there was no `vim.pack.del()`.

Solution: Add ` (not active)` suffix with distinctive highlighting to
  header of plugins that are not active.
  It will also be shown in in-process LSP document symbols to have quick
  reference about which plugins are not active.
This commit is contained in:
Evgeni Chasnovski
2025-12-28 18:07:32 +02:00
parent f5707a9c42
commit c339b83a4a
4 changed files with 31 additions and 5 deletions

View File

@@ -1622,6 +1622,29 @@ describe('vim.pack', function()
ref_fetch_lock.rev = git_get_hash('main', 'fetch')
eq(ref_fetch_lock, get_lock_tbl().plugins.fetch)
end)
it('hints about not active plugins', function()
exec_lua(function()
vim.pack.update()
end)
for _, l in ipairs(api.nvim_buf_get_lines(0, 0, -1, false)) do
if l:match('^## ') then
matches(' %(not active%)$', l)
end
end
-- Should also hint in `textDocument/documentSymbol` of in-process LSP,
-- yet still work for navigation
exec_lua('vim.lsp.buf.document_symbol()')
local loclist = fn.getloclist(0)
matches(' %(not active%)$', loclist[2].text)
matches(' %(not active%)$', loclist[4].text)
matches(' %(not active%)$', loclist[5].text)
n.exec('llast')
eq(21, api.nvim_win_get_cursor(0)[1])
end)
end)
it('works with not active plugins', function()