-
Notifications
You must be signed in to change notification settings - Fork 133
Local stubs files autocomplete not working but go to definition does #2047
Description
Environment data
- Language Server version: 0.5.50.0
- OS and version: Mac OS Catalina 10.15.4
- Python version: 3.8.2
Expected behaviour
Autocomplete should display available properties in the stub file
Actual behaviour
Autocomplete does not display available properties in the stub file
Python Language Server Logs
Analysis of main (User) queued. Dependencies: test
Completions in file:///Users/luispalacios/source/repos/stub-autocomplete-example/main.py at (3, 4)
Analysis version 206 of 1 entries has started.
Analysis of main (User) on depth 0 completed in 0.14 ms.
Analysis complete: 1 modules in 0.56 ms.
Analysis version 206 of 1 entries has been completed in 0.43 ms.
[Info - 4:20:39 PM] Predictions: add, setLevel, update, register, uppercase, data, connectionCls, append, send, refresh, log, exec_, run, register_opts, requires, addHandler, set, lower, run_doctest, setName
[Info - 4:20:39 PM] Time taken to get predictions: 12 ms, Memory increased: 90112 bytes
[Info - 4:20:39 PM] Deep learning IntelliCode recommendations service returned in 13 millis
IntelliCode identified 0 likely completion items.
Code Action in file:///Users/luispalacios/source/repos/stub-autocomplete-example/main.py at (3, 4) - (3, 4)
Code Action in file:///Users/luispalacios/source/repos/stub-autocomplete-example/main.py at (3, 4) - (3, 4)
Code Snippet / Additional lnformation
Consider three files on the root directory:
- test.py
- test.pyi
- main.py
Test.py
class Foo():
passTest.pyi
class Foo():
prop_1 = ... # type: typing___Text
prop_2 = ... # type: typing___Textmain.py
from test import Foo
foo = Foo()
foo. [no autocomplete for prop_1 or prop_2]I'm guessing the stub file is being read because got to definition works
I tried adding extrapaths for autocomple but still doesn't work:
settings.json
{
"python.jediEnabled": false,
"python.autoComplete.extraPaths": ["."]
}And last if I set jediEnabled: true autocomplete does work:
Why not directly add typing on the .py file itself? Well, this is actually a very reduced example to demonstrate the issue, I'm actually in a very similar setting like the one described here #2020. I'm generating classes from proto file trough protoc which uses metaclasses and autocomplete is not available however the dropbox team created a nice plugin to also generated the stubs files side by side but VS Code is not giving me autocompletion



