-
-
Notifications
You must be signed in to change notification settings - Fork 508
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
Django classes plugin #1401
Comments
Not sure if I understand you correctly, please let me know if I misunderstood you. The cs is
Now what you need to do is provide the proper filters so that when Does that help? Filters BTW are just there to find the right attribute on an instance/module/class/object. |
That helps. Sorry for my "logical" sequence in that question. It's miracle that you got me. But I've got new question. How can I create a filter of str, int, list etc.? |
Please have a look at the
Also note that if you have issues with the CI because of Python 2 or even anything else, I will fix it. Don't worry about that, just get it passing for a single Python version. |
Ok, I've prepared mapping of basic types UPD: |
It's generally possible to use
Yeah sorry, I changed a ton of code. |
Don't apologize! You, sir, make a python developer life better I'll fix the code ASAP |
One month later (facepalm) Actually I have no idea what's wrong. I try this code import jedi
source = '''
from enum import Enum
class Foo(Enum):
one = 1
two = 2
f = Foo.one
f.'''
script = jedi.Script(source, 9, len('f.'), 'example.py')
script.completions() calling
|
This looks like you have to upgrade parso to the latest git master branch. Sorry for the complications. |
What can I do to proceed? |
I think |
Ok, I've added some improvements just now and faced a problem that is related to ForeignKey field. It is a generic field which type depends on its arguments. There are two ways to define such field:
Let's resolve the second case. |
Not exactly sure what you want. Do you want to infer |
It might be worth creating a pull request that's in progress. I could help you there. |
Sorry for such lags. I have no chance to avoid the lack of time
Yes, I do.
Look at the code in the PR I created just now please. Hope the code make it more clear |
I've update the PR but I got new questions about the library API. The first, is there any case when |
Feel free to ask these questions in the pull request in the future. It's a bit easier to answer there, because I have context there :).
Theoretically, yes. Won't happen typically, but will happen in very few cases (if people do crazy stuff).
IMO what you do is fine for now. You have a TODO in there as well, which is good. We know that it's not perfect. But if we cover 95% of all cases, people will be very happy. So no need to handle those cases. People will probably also not notice, because the different values will probably be very similar. Theoretically you could work with names that return multiple values upon inferring them, but it's not really necessary here, so just ignore that. |
Since you wrote a Django classes plugin now, I'm going to close this one :). I'm still considering adding the stubs from https://github.com/typeddjango/django-stubs/tree/5b3088a17a76a77cb56a9c2241c2ddc6ccc8153a, but that's a separate issue. Django support should be coming in the next release. :) |
I made some adjustments and then added Django stubs and made sure to implement Two things are not implemented at the moment that would be nice to have:
So I think this should be good enough for Django for now. |
Hello! Regarding this comment I create new issue.
So... what is the object a class is passed of as argument
cls
of the function?I though it's a class of that object which the completions for. I test the code
so argument
cls
isModelBase
and that is true forp1
but it is looking for completion forp1_name
. I understand that the object is clone ofp1.product_name
but I don't understand the relation that Jedi sees. Would you mind to explain this?The text was updated successfully, but these errors were encountered: