-
Notifications
You must be signed in to change notification settings - Fork 15
[FIX] server: fix error on hover with no main EP #309
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
base: master
Are you sure you want to change the base?
Conversation
server/src/core/odoo.rs
Outdated
let path_symbol = entry.borrow().root.borrow().get_symbol(&tree, u32::MAX); | ||
if path_symbol.is_empty() { | ||
continue; | ||
if let Some(main_ep) = session.sync_odoo.entry_point_mgr.borrow().main_entry_point.as_ref(){ |
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.
but this way it means that the code won't work anymore for custom entrypoints if main entry is not set
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.
the if let is only around the first loop actually.
I am reading carefully.
So first loop actually only affects MAIN | (some) ADDON Entry points due to the condition
Second loop loops over custom entry points only
I think I can write the fix to be more readable in the future, by using iter_main
in the first loop
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
17c6416
to
5d91a4c
Compare
for entry in session.sync_odoo.entry_point_mgr.borrow().iter_main() { | ||
if (entry.borrow().typ == EntryPointType::MAIN || entry.borrow().addon_to_odoo_path.is_some()) && entry.borrow().is_valid_for(path) { |
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.
Due to this (entry.borrow().typ == EntryPointType::MAIN || entry.borrow().addon_to_odoo_path.is_some())
, we loop over public /builtin eps but always skip them.
Also since iter_main chains the iterators, it will be just empty if the option is None, so it guards against unwrap errors and also sorts for performance
No description provided.