-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Improve evaluation of class, decorated class, and decorated function definitions in Python with examples #618
Conversation
(= "for_statement" (node:type)) | ||
(= "call" (node:type)))) | ||
(log.dbg "form-node?: node:type =" (node:type)) | ||
(log.dbg "form-node?: node:parent =" (node:parent)) |
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.
Ohh good idea for a debug line, this will help diagnose some things.
(not (= "decorated_definition" (parent:type)))) true | ||
(and (= "function_definition" (node:type)) | ||
(not (= "decorated_definition" (parent:type)))) true | ||
false))) |
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.
Nice! I assume this is inspired by the Julia client changes? Discovering that :InspectTree
thing has made this a lot easier to reason about thankfully.
Not sure if we explicitly need to return true or false here though, I feel like we can get away with truthy and falsy. But if this is easier to reason about or you had issues without explicit boolean return values then this is fine.
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.
Yes, I took inspiration from your changes to the Julia client while working on trying to upgrade an ancient Django project from version 1.9.
I was having some trouble getting the evaluation of classes and decorated classes/functions. In anger, I just did the simplest thing to keep me from confusing myself.
Tried it out locally and it works wonderfully, thanks! This tree sitter system is working pretty well 😄 |
Thanks for making Conjure and making all of this possible! |
Improved evaluation with
<localleader>ee
for class definitions and decorated class and function definitions in the Python client. Added some representative code for these cases tosandbox.py
.