Skip to content

feat: dev mode#17

Open
mbwilding wants to merge 3 commits intozuqini:mainfrom
mbwilding:main
Open

feat: dev mode#17
mbwilding wants to merge 3 commits intozuqini:mainfrom
mbwilding:main

Conversation

@mbwilding
Copy link
Copy Markdown

No description provided.

@mbwilding mbwilding changed the title Implement dev mode, compliant with lazy.nvim feat: dev mode Apr 16, 2026
Copy link
Copy Markdown
Owner

@zuqini zuqini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! The change looks reasonable and I don't see any major concerns with the implementation, but I need to sleep on the direction.

In general I think zpack should delegate to vim.pack for plugin management, and this feature bypasses it entirely.

Could you describe what dev mode is meant to achieve, and what specifically can't be done through the vim.pack API?

Comment thread lua/zpack/import.lua
end

local src = get_source_url(spec)
if not src then goto continue end
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This guard is unreachable — get_source_url above still calls error(err) when normalize_source returns nil, so a missing dev directory aborts the whole import pipeline before this runs.

I think either drop the error(err) so nil propagates here and shedule_notify an error, or handle the dev miss with schedule_notify + return nil in normalize_source

Comment thread lua/zpack/utils.lua
M.load_local_plugin = function(path, source_plugin_files)
vim.opt.runtimepath:prepend(path)
if source_plugin_files then
local files = vim.fn.glob(path .. '/plugin/**/*.{vim,lua}', false, true)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:packadd also sources ftdetect/**/*; bypassing it here means filetype detection shipped inside a dev plugin won't fire.

I'm not completely sure what the best solution is, or if it should be considered in-scope forzpack.nvim to re-implement :packadd

Comment thread lua/zpack/import.lua

---@param spec zpack.Spec
---@return string
---@return string|nil
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that because of https://github.com/zuqini/zpack.nvim/pull/17/changes#r3097565585, this currently never returns nil.

-- not call the load callback for local directories. Register them directly
-- with a synthetic plugin object so the rest of the pipeline (startup,
-- lazy triggers, config hooks) works normally.
for _, pack_spec in ipairs(local_packs) do
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor architecture point: previously pack_spec.name was always populated by vim.pack.add before register_plugin saw it. This backfill keeps that invariant working, but splits name-derivation across two spots — could we do it once during resolve instead?

Copy link
Copy Markdown
Owner

@zuqini zuqini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we decide to pursue this feature, we should also add unit-tests to cover the new code-paths and update the helpfile.

Though perhaps these can be part of a future PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants