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

Support for fields in Python #3

Closed
Desdaemon opened this issue Aug 31, 2023 · 1 comment
Closed

Support for fields in Python #3

Desdaemon opened this issue Aug 31, 2023 · 1 comment

Comments

@Desdaemon
Copy link
Owner

Completions/references/definitions for fields in Python (already done in XML)

class Foo(models.Model):
    def fun(self):
        self.env['foo.bar'].|

Two approaches:

  • Self-contained: perform rudimentary analysis by walking the AST to determine if expression is a model type, then generate completions based on that information.
    • Doable, does not depend on Python
    • Con: duplicates the work of Pyright
  • Pyright: find a way to supplement type info for Pyright from outside
    • If successful, other features can benefit as well
    • Con: Pyright does not expose an easily consumable API
@Desdaemon
Copy link
Owner Author

Third approach: Mypy

  • Has a plugin framework suitable for this purpose
  • Con: Communication between the LSP and mypy is non-trivial and adds overhead
  • Con: Desync between pyright and mypy is very easy

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

No branches or pull requests

1 participant