Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Packer v2 Rewrite#1042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
wbthomason wants to merge25 commits intomaster
base:master
Choose a base branch
Loading
fromrefactor/packer-v2
Draft

Packer v2 Rewrite#1042

wbthomason wants to merge25 commits intomasterfromrefactor/packer-v2

Conversation

@wbthomason
Copy link
Owner

This is a WIP PR to complete the first stage ofthis
roadmap
,
at least through theload function.

Current progress:

  • Add some initial TODOs
  • Put configuration into its own module
  • WIP main module rewrite
  • Implement specification flattening
  • Add ensure_table function
  • WIP flattening iterator for plugin specs
  • Minor code cleanup, preparing to restart work
  • Simplify headless check
  • Simplify ensure_table
  • Use new Lua commands API for Packer commands
  • Use new Lua autocommands API for PackerComplete
  • WIP moving to runtime-handlers implementation
  • Add path lib
  • Make profile lib from compile functions
  • Always ensure dependencies
  • Use path lib in config
  • Signal existence of profiling threshold config var
  • Add hooks for modules that need to know about updated config values
  • WIP everything-as-handlers-no-compile approach
  • Belay changing load for now
  • Add proper timed_load and rename old one to timed_packadd
  • Cleanup log module use a bit
  • WIP handler definitions
  • Add note about feature request from lewis6991
  • First draft of rewrite roadmap

The next steps are:

  • Completing the keyword handler set
  • Writing the load() function
  • Presumably fixing some bugs
  • Potentially some re-engineering to minimize the startup cost of now always needing to require thepacker module and your plugin specs.

Contributions to this PR are welcome!

ianbattersby reacted with rocket emoji
@wbthomason
Copy link
OwnerAuthor

Tagging@akinsho,@EdenEast, anyone else interested in contributing to the rewrite.

EdenEast, max397574, and kuator reacted with thumbs up emojiEdenEast, bryant-the-coder, and kuator reacted with eyes emoji

- Add tests where possible: testing a package manager can be a pain because of requirements to interact with the file system, etc. However, `packer`'s current tests do not cover much, and new code should at least strongly consider adding unit tests.
- Avoid giant functions: `packer`'s logic contains some monstrous functions (e.g., `manage`, the main compilation logic, etc.) that are difficult to work with. New code should strive to use more, simpler functions in a more modular design.
- Prioritize clean, performant code over total flexibility: `packer`'s design allows for a very flexible range of input formats. Although we don't want to completely lose this property, supporting all of these formats (and other use cases) has contributed to code bloat. If there's a choice to be made between losing some flexibility and significantly increasing the complexity of the code, seriously consider removing the complexity.
- Reduce redundancy: `packer` currently has an annoying amount of redundant/overlapping functionality (the worst offenders are the `requires`/`wants`/`after` family of keywords, but there's also duplication of logic in the utilities, etc.). The rewrite should aim to reduce this.
Copy link
Contributor

Choose a reason for hiding this comment

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

Generally this looks great!

Regarding redundancy, there's a lot of code-duplication inpacker.update andpacker.sync. Maybe there are reasons for this but if things are structured well, it seems likesync could just be something like:

packer.sync=function(..)packer.clean()packer.update(...)packer.compile()end

Copy link
OwnerAuthor

Choose a reason for hiding this comment

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

That's the idea! I just haven't gotten to that part of the rewrite yet.

AckslD and kuator reacted with rocket emoji
@akinsho
Copy link
Collaborator

akinsho commentedSep 6, 2022
edited
Loading

@wbthomason thanks for opening it, looks good 👍🏿. I was thinking I'd raise some PRs against this to help move it on, but will probably start with smaller things like adding Emmy Lua annotations to as many places as possible. I personally heavily rely on those when writing Lua, so would be nice if the types in the code base were clearer.

I've also been using the lazy loading pattern popularized by TJ inhttps://github.com/tjdevries/lazy.nvim and thought I might add it here? It defers the requiring of modules till they are actually indexed, so you can require all modules at the top of a file, but they won't actually be required till they are used. You can then combine this withsumneko's@module syntax to keep the type information, e.g.

locallazy=require('packer.lazy')--- @module'packer.config'localconfig=lazy.require('packer.config')

Primarily because you've talked about reducing the cost of requiring packer, so this should help.

EdenEast, AckslD, wbthomason, kuator, and WuerfelDev reacted with thumbs up emoji

@wbthomason
Copy link
OwnerAuthor

Oh, brilliant! That looks quite useful. Separately, more annotations is also a great way to start - that's a stated goal of the rewrite and will make working with the codebase substantially nicer. Thanks!

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

Reviewers

1 more reviewer

@AckslDAckslDAckslD left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@wbthomason@akinsho@AckslD

[8]ページ先頭

©2009-2025 Movatter.jp