microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.71k stars 767 forks source link

No Intellisense when the file is saved after Pylance initializes #3817

Open MufanColin opened 1 year ago

MufanColin commented 1 year ago

Environment data

Code Snippet

import sys

XXX

Repro Steps

  1. open the integrated terminal in vscode and type code test1.py to create a new empty file called test1.py(with all python extensions installed, python, pylance, etc.)
  2. notice that at this time, there will be white dot after test1.py which indicates that this file is not saved yet.
  3. do not type anything into the test1.py file and press command + S to save the file
  4. now the white dot after test1.py disappears
  5. type import sys
  6. no intellisense suggestions
  7. type sys.(sys and a dot after it)
  8. no intellisense suggestions for methods inside sys module. This problem can be solved by closing the window and reopening vscode, but it is not very convenient.

    Expected behavior

XXX

Actual behavior

XXX

Logs

XXX
debonte commented 1 year ago

I'm able to repro this. It seems that it only repros if the file is saved after Pylance initializes. If you save early enough, completions work as expected.

When it repros, Pylance does get textDocument/completion requests, but its replies are empty (no results).