Skip to content

Conversation

@cammarosano
Copy link
Collaborator

@cammarosano cammarosano commented Dec 12, 2025

This PR introduces:

  • a fix for evaluations that got incorrectly dropped by follow_ref
  • support for property (functions) in follow_ref, following its evaluation to its return type

@odoostan
Copy link
Member

Hi @cammarosano long time no see ! I think all "references" features are missing for now ?
For me "Go to definition" goes to the og file (but the first line not the line where the method is defined)
And "Go to references" and "Find all references" never worked for any method.

The issue:
In follow_ref's main loop, popping from the front of the results Deque
when meaning to replace an evaluation would not necessarily remove the
correct one.

In order to fix this and reduce complexity of the main loop with a
moving index over a Deque, we switch to a work queue approach:
- evaluations that need to be processed are pushed to and popped from
the work queue,
- final evaluations are pushed to the results vector.

Other changes:
- `acc` was renamed to `visited` for clarity.
- some indentation could be reduced with `let else` constructs, improving
readability.
When following symbol references, also follow functions that are
properties, in addition to variables and class instances. This ensures
that properties are correctly resolved to the return type of the
underlying function.
@cammarosano cammarosano force-pushed the alpha-follow_ref_to_propery-rcdl branch from b06bdd9 to 9cf1860 Compare December 12, 2025 10:51
@cammarosano cammarosano changed the title Follow ref to property [FIX] [IMP] Resolve property type Dec 12, 2025
@cammarosano cammarosano mentioned this pull request Dec 12, 2025
Comment on lines +2316 to +2319
// TODO: this arm can be easily merged with the one for SymType::CLASS, but
// - do we need to propagate instance = True here too (like we do for variables, but not class...)?
// - do we need to build_now for functions like we do for variables? In case yes, BuildSteps::ARCH_EVAL or VALIDATION?
// - stop_on_type, stop_on_value and max_scope apply also for this case?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To be discussed with @fda-odoo

@cammarosano
Copy link
Collaborator Author

Hi @cammarosano long time no see ! I think all "references" features are missing for now ? For me "Go to definition" goes to the og file (but the first line not the line where the method is defined) And "Go to references" and "Find all references" never worked for any method.

Hey @odoostan ! Good to hear from you!
Indeed, "references" feature is not yet implemented for Python.
Now, "go to definition" should work. Can you provide an example where it doesn't?

@odoostan
Copy link
Member

Hello @cammarosano
Thank you for following up on this, and for your work on this amazing project in general 👍

After some testing, it seems "Go to definition" works fine in all cases except when used in code outside of the usual addons_path.

Example: base/models/res_company.py

  1. Methods in same module like button_immediate_install: work fine ✔️
  2. Generic methods like browse: no definition found ❌

And in the usual paths, we get kind of the opposite.

Example: account/models/partner.py

  1. Most methods work fine, even generic methods like browse ✔️
  2. Methods defined outside of the path like button_immediate_install: no definition found ❌

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