You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When working with docstrings, we often need to pass down the docstring parser options selected by the user. The only way to access those is through the agent, but we don't have any reference to the agent from extension hooks.
Describe the solution you'd like
Pass the agent reference to extension hooks. This will require inspecting the signature of hooks first (in v0). For forward-compatibility, we could add **kwargs to all hooks, so that users remember to add it to their own hooks (IDEs will help by copying the signature).
Accepting **kwargs means users could also avoid listing node: ast.AST | griffe.ObjectNode in their hook parameters (not often used), or any other parameter, simplifying signatures and imports.
Attaching the agent reference to the extension itself, in an attribute. But that's ugly and error prone (state to manage).
Or always inspecting the hook signature to know which arguments to pass, to avoid type errors (even in v1).
Additional context
/
The text was updated successfully, but these errors were encountered:
Some extensions need to know the user-selected docstring parser and options. The docstring parser and options can only be accessed through the agent.
Other extensions who create objects might want to trigger the rest of the extensions, which can again only be done if we have a reference to the agent.
Issue-312: #312
Is your feature request related to a problem? Please describe.
When working with docstrings, we often need to pass down the docstring parser options selected by the user. The only way to access those is through the agent, but we don't have any reference to the agent from extension hooks.
Describe the solution you'd like
Pass the agent reference to extension hooks. This will require inspecting the signature of hooks first (in v0). For forward-compatibility, we could add
**kwargs
to all hooks, so that users remember to add it to their own hooks (IDEs will help by copying the signature).Accepting
**kwargs
means users could also avoid listingnode: ast.AST | griffe.ObjectNode
in their hook parameters (not often used), or any other parameter, simplifying signatures and imports.Describe alternatives you've considered
Attaching the agent reference to the extension itself, in an attribute. But that's ugly and error prone (state to manage).
Or always inspecting the hook signature to know which arguments to pass, to avoid type errors (even in v1).
Additional context
/
The text was updated successfully, but these errors were encountered: