Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins/lz-n: init #1874

Merged
merged 1 commit into from
Aug 8, 2024
Merged

plugins/lz-n: init #1874

merged 1 commit into from
Aug 8, 2024

Conversation

psfloyd
Copy link
Contributor

@psfloyd psfloyd commented Jul 16, 2024

This is the first PR of splitting PR #1866.

This PR adds:

  • plugins.lz-n and its options for lazy-loading plugins using lz.n.
  • Tests for plugins.lz-n.

Copy link
Member

@MattSturgeon MattSturgeon 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 working on this!

It's looking good, I've just left a few comments below to hopefully improve things further

plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
@psfloyd
Copy link
Contributor Author

psfloyd commented Jul 17, 2024

I have made the changes suggested by the review.

A question more about GitHub ettiquette. Should I keep these changes in its own commit, or should i squash them to the original commit?

Copy link
Member

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

I have made the changes suggested by the review.

Thanks!

A question more about GitHub ettiquette. Should I keep these changes in its own commit, or should i squash them to the original commit?

Personally, it doesn't bother me either way.

Having separate commits can be beneficial since that way you can more easily tell what has changed, although it's still possible to diff force-pushes.

The most important thing is that it is easy to squash the changes once the PR has moved on enough that having separate commits is no longer needed.

On more complex PRs you can end up with conflicts when squashing lots of small changes that were committed in a different order.

Also, if you're not aware, git commit --fixup and git rebase -i --autosquash can be very useful.


I've focused this review on the plugins option and attempting to make it fit better with RFC42.

See this section of our contributing guide, or the RFC itself.

For some of the discussion points I'd appreciate input from the other maintainers @nix-community/nixvim

plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
@psfloyd
Copy link
Contributor Author

psfloyd commented Jul 18, 2024

Thank you for your review and guidance!

I made most of the changes suggested. Some things still need input from reviewers.

@psfloyd
Copy link
Contributor Author

psfloyd commented Jul 21, 2024

I think I resolved most of the concerns. All the magic for setting options was removed.
All trigger options now accept rawLua.

If there is anything else I need to change, please let me know.

Copy link
Member

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

A few nits, but mostly just discussion points.

The main blocker now is discussing the best way to handle documenting unkeyed attrs as part of a well-defined submodule.

The PR itself is in good shape, well done! 🎉

submodule {
freeformType = attrsOf anything;
options = {
__unkeyed = mkOption {
Copy link
Member

Choose a reason for hiding this comment

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

listToUnkeyedAttrs uses __unkeyed-1:

nixvim/lib/utils.nix

Lines 15 to 17 in 47b6c48

listToUnkeyedAttrs =
list:
builtins.listToAttrs (lib.lists.imap0 (idx: lib.nameValuePair "__unkeyed-${toString idx}") list);

I guess for consistency we should too? On the other hand maybe it's better is this doesn't specify an index, to allow users to add unkeyed table entries with any index (via freeform definitions)?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we've ever had an "unkeyed" option definition before... So far all unkeyed attrs have been in freeform definitions.

I can't see a better alternative, it just feels as though we're now more publicly exposing the messy side of trying to map nix values to lua tables. And in doing so committing more solidly to our current strategy? 🫤

@traxys are you happy with this approach?

plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
tests/test-sources/plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
tests/test-sources/plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
tests/test-sources/plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
Copy link
Member

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

Thanks, I think this is pretty much done. There's just a couple thinks I'd like a second opinion on from another maintainer.

Other than that it's just nits below. Now the PR is pretty much done, could you try and keep the commits squashed to just the two "add maintainer" and "add plugin" commits?

Also, sorry this took a while for me to look at. If it's ready for review and you have been waiting, don't hesitate to ping one of us, since it's easy for individual PRs to get forgotten about otherwise!

plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Show resolved Hide resolved
Comment on lines 47 to 54
enabled = helpers.defaultNullOpts.mkStrLuaFnOr bool true ''
When false, or if the function returns false, then this plugin will not be included in the spec.
This option corresponds to the `enabled` property of lz.n.
'';
beforeAll = helpers.mkNullOrLuaFn "Always executed before any plugins are loaded.";
before = helpers.mkNullOrLuaFn "Executed before this plugin is loaded.";
after = helpers.mkNullOrLuaFn "Executed after this plugin is loaded.";
load = helpers.mkNullOrLuaFn "Can be used to override the `vim.g.lz_n.load()` function for this plugin.";
Copy link
Member

Choose a reason for hiding this comment

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

@GaetanLepage @traxys are we happy to introduce new strLua options if we're considering deprecating strLua?

I guess this is fine since we haven't properly discussed it yet and made a decision?

plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
tests/test-sources/plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
tests/test-sources/plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
@psfloyd
Copy link
Contributor Author

psfloyd commented Aug 3, 2024

Great, thanks for taking a look at it again. I applied all the changes and some other style changes suggested by GaetanLepage on #1979. I sqashed all comits as requested.

No worries about the wait, I took that time to improve my personal nixvim config ;).

Regarding the strLua options, if it is necesary I can reafactor the options with another type. I prefer to have a stable interface for #1875.

@MattSturgeon
Copy link
Member

Regarding the strLua options, if it is necesary I can reafactor the options with another type. I prefer to have a stable interface for #1875.

I think it's fine. Nixvim is full of strLua, so this won't make any eventual deprecation notably worse.

I think other maintainers will take a look over the next few days 🤞

@MattSturgeon
Copy link
Member

Great, thanks for taking a look at it again. I applied all the changes and some other style changes suggested by GaetanLepage on #1979. I sqashed all comits as requested.

Thanks for your persistent work & dedication on these PRs!

@MattSturgeon
Copy link
Member

cannot build on 'ssh-ng://[email protected]': error: failed to start SSH connection to '[email protected]'
Failed to find a machine for remote build!
derivation: 39zgfnw2zax5d7qyr7894a99dizldi7i-plugins-utils-mark-radar.drv
required (system, features): (aarch64-linux, [])
2 available machines:
(systems, maxjobs, supportedFeatures, mandatoryFeatures)
([aarch64-linux], 80, [benchmark, big-parallel, gccarch-armv8-a, kvm, nixos-test], [])
([aarch64-darwin, x86_64-darwin], 8, [big-parallel], [])
error: a 'aarch64-linux' with features {} is required to build '/nix/store/39zgfnw2zax5d7qyr7894a99dizldi7i-plugins-utils-mark-radar.drv', but I am a 'x86_64-linux' with features {benchmark, big-parallel, kvm, nixos-test}

Seems like a buildbot issue? Just strange it's only happening on this PR. Will try rebuilding.

@psfloyd
Copy link
Contributor Author

psfloyd commented Aug 4, 2024

I think other maintainers will take a look over the next few days 🤞

Great!

Thanks for your persistent work & dedication on these PRs!

Thanks to all of you for maintaining this awesome project.

Seems like a buildbot issue? Just strange it's only happening on this PR. Will try rebuilding.

I saw the error, but since it was not in the lz-n tests I didn't know how to troubleshoot it.

Copy link
Member

@GaetanLepage GaetanLepage left a comment

Choose a reason for hiding this comment

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

Minor nit, otherwise good to me !

plugins/pluginmanagers/lz-n.nix Outdated Show resolved Hide resolved
Copy link
Member

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

LGTM, are you happy @GaetanLepage?

Copy link
Member

@GaetanLepage GaetanLepage left a comment

Choose a reason for hiding this comment

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

Yes, let's go !

@GaetanLepage
Copy link
Member

@Mergifyio queue

Copy link
Contributor

mergify bot commented Aug 8, 2024

queue

🛑 The pull request has been removed from the queue default

The queue conditions cannot be satisfied due to failing checks.

You can take a look at Queue: Embarked in merge queue check runs for more details.

In case of a failure due to a flaky test, you should first retrigger the CI.
Then, re-embark the pull request into the merge queue by posting the comment
@mergifyio refresh on the pull request.

@GaetanLepage
Copy link
Member

https://github.com/Mergifyio queue

Copy link
Contributor

mergify bot commented Aug 8, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 78abafe

@mergify mergify bot merged commit 78abafe into nix-community:main Aug 8, 2024
4 checks passed
@psfloyd psfloyd deleted the lz.init branch August 8, 2024 23:22
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.

4 participants