-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add Missing Internal Fields #318
Conversation
4ff71e9
to
c5c0ef3
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #318 +/- ##
=======================================
Coverage 99.04% 99.04%
=======================================
Files 20 20
Lines 2720 2723 +3
=======================================
+ Hits 2694 2697 +3
Misses 26 26 ☔ View full report in Codecov by Sentry. |
lua/nui/popup/init.lua
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey thanks for looking into it!
A fix like this would be more appropriate for it:
diff --git a/lua/nui/menu/init.lua b/lua/nui/menu/init.lua
index dff06a7..22b79de 100644
--- a/lua/nui/menu/init.lua
+++ b/lua/nui/menu/init.lua
@@ -283,7 +283,7 @@ function Menu:init(popup_options, options)
self._.sep = options.separator
self._.should_skip_item = defaults(options.should_skip_item, default_should_skip_item)
- self._.prepare_item = defaults(options.prepare_item, make_default_prepare_node(self))
+ self._.prepare_item = options.prepare_item
self.menu_props = {}
@@ -316,6 +316,13 @@ function Menu:init(popup_options, options)
end
end
+---@param config? nui_layout_options
+function Menu:update_layout(config)
+ Menu.super.update_layout(self, config)
+
+ self._.prepare_item = defaults(self._.prepare_item, make_default_prepare_node(self))
+end
+
function Menu:mount()
Menu.super.mount(self)
Here we're defering the execution of make_default_prepare_node
if NuiMenu
is used in a layout and prepare_item
is missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated PR! Thank you for the guidance 🙂
c5c0ef3
to
348054a
Compare
348054a
to
34c7be3
Compare
This PR resolves the following:
Missing required fields in type `nui_popup_internal`: `position`, `size`.
size
field.Very new to the project so please let me know if there are specific unit tests I should update/add!
Error:
To reproduce: