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
{{ message }}
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Support Django model objects in IntelliSense #1934
Extension version (available under the Extensions sidebar): 2018.7.1
OS and version: Windows 10
Python version (& distribution if applicable, e.g. Anaconda): Anaconda Python 3.6.5
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): Conda
Relevant/affected Python packages and their versions: Django 2.0.6
Actual behavior
Intellisense/pylint do not offer autocompletion for a member variable inherited from a base class and shows it as a problem: E1101:Class 'Question' has no 'objects' member
The code runs exactly as intended without errors.
I am actually following the Django tutorial from the official site.
Expected behavior
The object's member should be shown in intellisense and it shouldn't log it as a problem
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
Everything runs ok. there is actually nothing in output.
Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)
System check identified no issues (0 silenced).
July 28, 2018 - 10:47:36
Django version 2.0.6, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[28/Jul/2018 10:47:43] "GET /polls/ HTTP/1.1" 200 11
changed the title [-]IntelliSense stopped providing completions for inherited variables and methods in 2018.7.1[/-][+]Support Django model objects in IntelliSense[/+]on Jul 30, 2018
That's because Django's objects() method is magical and not discoverable from code analysis. IOW this requires special Django code that both Jedi, Pylint, and our language server do not have. I have made this a feature request, though, for our language server to add support.
Instead of special-casing Django in the LS, is it possible for users of magic-dependent frameworks to provide explicit hint data to the analyzer?
I ask this as a Django user who'd find Django support super useful, but if some kind of hint data format/API is possible then it'd open the possibilities up wider, and it'd make the feature less brittle. However, it might also be more work and create a longer-term liability in supporting an open hinting system.
Yoz Grahame (@yozlet) good point! I'm sure the language server team will handle it as generically as possible, with the Language Server Protocol and niceties like the DocumentSelector I think they will be able to handle 'special cases' like this.
Activity
[-]IntelliSense stopped providing completions for inherited variables and methods in 2018.7.1[/-][+]Support Django model objects in IntelliSense[/+]brettcannon commentedon Jul 30, 2018
That's because Django's
objects()method is magical and not discoverable from code analysis. IOW this requires special Django code that both Jedi, Pylint, and our language server do not have. I have made this a feature request, though, for our language server to add support.yozlet commentedon Aug 16, 2018
Instead of special-casing Django in the LS, is it possible for users of magic-dependent frameworks to provide explicit hint data to the analyzer?
I ask this as a Django user who'd find Django support super useful, but if some kind of hint data format/API is possible then it'd open the possibilities up wider, and it'd make the feature less brittle. However, it might also be more work and create a longer-term liability in supporting an open hinting system.
d3r3kk commentedon Aug 16, 2018
Yoz Grahame (@yozlet) good point! I'm sure the language server team will handle it as generically as possible, with the Language Server Protocol and niceties like the
DocumentSelectorI think they will be able to handle 'special cases' like this.simonmelouah commentedon Dec 16, 2018
Would love this support too!
jakebailey commentedon Mar 11, 2020
Duplicate of #129.