mirror of
https://github.com/neovim/neovim.git
synced 2026-04-20 06:20:53 +00:00
feat(pack)!: suggest "delete" code action only for not active plugins
Problem: Deleting active plugins can lead to a situation when it is reinstalled after restart. Solution: Suggest "delete" code action only for not active plugins. Whether a plugin is not active is visible by a hint in its header.
This commit is contained in:
@@ -1161,8 +1161,9 @@ end
|
||||
--- show more information at cursor. Like details of particular pending
|
||||
--- change or newer tag.
|
||||
--- - 'textDocument/codeAction' (`gra` via |lsp-defaults| or |vim.lsp.buf.code_action()|) -
|
||||
--- show code actions available for "plugin at cursor". Like "delete", "update",
|
||||
--- or "skip updating".
|
||||
--- show code actions available for "plugin at cursor".
|
||||
--- Like "delete" (if plugin is not active), "update" or "skip updating"
|
||||
--- (if there are pending updates).
|
||||
---
|
||||
--- Execute |:write| to confirm update, execute |:quit| to discard the update.
|
||||
--- - If `true`, make updates right away.
|
||||
|
||||
@@ -151,7 +151,9 @@ methods['textDocument/codeAction'] = function(params, callback)
|
||||
new_action('Skip updating', 'skip_update_plugin'),
|
||||
}, 0)
|
||||
end
|
||||
vim.list_extend(res, { new_action('Delete', 'delete_plugin') })
|
||||
if not vim.pack.get({ plug_data.name })[1].active then
|
||||
vim.list_extend(res, { new_action('Delete', 'delete_plugin') })
|
||||
end
|
||||
callback(nil, res)
|
||||
end
|
||||
|
||||
@@ -161,7 +163,7 @@ local commands = {
|
||||
end,
|
||||
skip_update_plugin = function(_) end,
|
||||
delete_plugin = function(plug_data)
|
||||
vim.pack.del({ plug_data.name }, { force = true })
|
||||
vim.pack.del({ plug_data.name })
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user