microsoft / python-language-server

Microsoft Language Server for Python
Apache License 2.0
910 stars 130 forks source link

"No Symbol information for the file" even when inside the file #1893

Open aderchox opened 4 years ago

aderchox commented 4 years ago

Environment data

Expected behaviour

I installed python-pptx and then opened the Presentation.__file__ in it and then chose Go-to Symbol in File, I expect it to list the symbols in that file.

Actual behaviour

But it says: "No symbol information for the file". I've also waited there thinking it might be still loading things but it's permanent and is not showing the symbols. Then I thought it might be because of the kind of deep installation path of my Python (in the local in the appdata, is that deep?) and so copied the file to the root of a drive and now when I reopen it, the option works instantly. Could someone tell me whether it's really my bad Python installation path or something else? I read here that such an issue might be an extension thing so I'm posting this here.

Steps to reproduce:

  1. pip install python-pptx
  2. open the file Presentation.__file__
  3. Hit Ctrl+Shift+O or Click on Go -> Go to Symbol in File
  4. the list is empty and the message there is: "No Symbol information for the file".

Logs

User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'DebugAdapterFactory - experiment'
User belongs to experiment group 'PtvsdWheels37 - experiment'
User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control'
> conda --version
> pyenv root
> python3.7 -c "import sys;print(sys.executable)"
> python3.6 -c "import sys;print(sys.executable)"
> python3 -c "import sys;print(sys.executable)"
> python2 -c "import sys;print(sys.executable)"
> python -c "import sys;print(sys.executable)"
> py -3.7 -c "import sys;print(sys.executable)"
> py -3.6 -c "import sys;print(sys.executable)"
> py -3 -c "import sys;print(sys.executable)"
> py -2 -c "import sys;print(sys.executable)"
> ~\AppData\Local\Programs\Python\Python37\python.exe -c "import sys;print(sys.executable)"
> ~\AppData\Local\Microsoft\WindowsApps\python.exe c:\Users\mojta\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Microsoft\WindowsApps\python.exe c:\Users\mojta\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Microsoft\WindowsApps\python3.exe c:\Users\mojta\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Microsoft\WindowsApps\python3.exe c:\Users\mojta\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\interpreterInfo.py
> C:\ProgramData\Anaconda3\Scripts\conda.exe info --json
Starting Microsoft Python language server.
> (value not set)\python.exe c:\Users\mojta\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\interpreterInfo.py
> (value not set)\python.exe c:\Users\mojta\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\interpreterInfo.py
> C:\ProgramData\Anaconda3\Scripts\conda.exe env list
> (value not set)\python.exe c:\Users\mojta\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\interpreterInfo.py
> (value not set)\python.exe c:\Users\mojta\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Programs\Python\Python37\python.exe c:\Users\mojta\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Programs\Python\Python37\python.exe c:\Users\mojta\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Programs\Python\Python37\python.exe -m pip --version
Starting Microsoft Python language server.

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging) (I open the console but I really have no idea where to run Enable source map support for extension debugging, it doesn't sound like JavaScript to be entered in the console :/ )

MikhailArkhipov commented 4 years ago

Somewhat similar to https://github.com/microsoft/python-language-server/issues/178. __file__ is not a static property, it is a dynamically added object. LS is a static analyzer and does not run any Python code hence dynamically added members won't show up.

Presentation is just a function that returns dynamically constructed object.