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

Better domains - autocompletion, diagnostics, hover #167

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

fda-odoo
Copy link
Collaborator

The PR contains all changes and fixs about search domains.

  • Autocompletion for fields
  • comprehension of fields that contains dots
  • fix wrong diagnostics of invalid fields
  • hover of fields

@fda-odoo fda-odoo self-assigned this Dec 19, 2024
@fda-odoo fda-odoo added bug Something isn't working enhancement New feature or request labels Dec 19, 2024
@fda-odoo fda-odoo added this to the 0.4.0 milestone Dec 19, 2024
@fda-odoo fda-odoo force-pushed the master-domains-auto-fda branch from 02e2c6c to 1cb2e18 Compare January 7, 2025 12:07
@fda-odoo fda-odoo marked this pull request as ready for review January 7, 2025 13:20
@fda-odoo fda-odoo requested a review from mmahrouss January 9, 2025 15:16
Copy link
Collaborator

@mmahrouss mmahrouss left a comment

Choose a reason for hiding this comment

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

Nice really cool!
Just one question on a comment, otherwise looks great!

let from_module = file.borrow().find_module().clone();
Symbol::all_members(&parent, session, &mut all_symbols, true, from_module, &mut None, false);
for (_symbol_name, symbols) in all_symbols {
//we could use symbol_name to remove duplicated names, but it would hide functions vs variables
Copy link
Collaborator

Choose a reason for hiding this comment

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

But we cannot have functions and variables with the same name, can we?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could. Some would be shadowed, but as we are searching here in classes, inheritance, co-models,... we could find different symbols type with the same name

@fda-odoo fda-odoo force-pushed the master-domains-auto-fda branch from a69760d to fdbf24f Compare January 15, 2025 09:45
@fda-odoo fda-odoo force-pushed the master-domains-auto-fda branch from 52385d1 to b8f641e Compare January 22, 2025 13:23
fda-odoo and others added 14 commits January 23, 2025 14:56
on models, get_symbols returns all symbols that build the model, but there was no easy way to get all symbols that build the model with inherited models. get_full_model_symbols do it now. It doesn't contain inheritS howevers.
Add return values for with_company, with_context, with_prefetch, with_user, with_env, exists
Contexts was not really consistent and wrongly used.
This rework will state that contexts passed as parameters to functions like follow_ref are global contexts linked to the evaluation of the current expression.
EvaluationSymbolWeak now contains a Context, that is a local Context to this symbol, able to hold specific informations that would not be in the tree.
It is mostly used for hooks and odoo code. For example, it will store used __init__ parameter in my_field = fields.Many2one("a_model"), so we can know the linked a_model
to that field later on.
This commit also include some rework on EvaluationSymbolWeak and Ptr and most functions now returns Ptr instead of Weak, to be able to express different kind of values.
@fda-odoo fda-odoo force-pushed the master-domains-auto-fda branch from 4a8cc89 to 4558aab Compare January 23, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants