Does anyone know what could cause VS Code to suddenly have syntax highlighting go haywire, and autocompletion/intellisense stop working? I have tried reinstalling VS Code, switching to the VS Code insiders version, disabling unused extensions. No matter what I do a few minutes after opening VS code highlighting goes nuts and Pylance intellisense drops out.
For example:
The only unusual thing I see in the language server output is:
2023-08-10 09:35:08.006 [info] Error: Debug Failure. False expression: Chained file path undefined doesn't match cellFilePaths c:Usersjulian.irwinOneDrive - Thermo Fisher ScientificProjectsXXXXpython notebooksxxxxxxxxxlamp_noise_study.ipynb:pylance-notebook-cell:X15sZmlsZQ==.py
at _0x2f5209 (c:Usersjulian.irwin.vscode-insidersextensionsms-python.vscode-pylance-2023.8.20distserver.bundle.js:1:1017323)
at c:Usersjulian.irwin.vscode-insidersextensionsms-python.vscode-pylance-2023.8.20distserver.bundle.js:1:1024550
at _0x3100be.<computed> (c:Usersjulian.irwin.vscode-insidersextensionsms-python.vscode-pylance-2023.8.20distserver.bundle.js:1:1024582)
at _0x72f7ac._onDidChangeNotebookDocumentAsync (c:Usersjulian.irwin.vscode-insidersextensionsms-python.vscode-pylance-2023.8.20distserver.bundle.js:1:1003431)
Much of the language server output has path names containing sensitive information so I didn’t post the full output. I can scrub and then post them if it would help someone debug this.
Another mysterious fact is that a python file (.py) opened in a different tab works fine. Highlighting and autocompletion are fully function. It is only in the notebook environment that the problem occurs.
Possibly related to this Pylance issue:
https://github.com/microsoft/pylance-release/issues/4685
Suggested solution is to downgrade to Pylance v2023.7.40
Versions:
windows 11
vscode 1.81.0
vscode 1.82.0-insider (also tried with this one!)
python 3.11.1
ipykernel 6.19.4
VSCode Extensions
Jupyter v2023.7.1002162226
Python v2023.14.0
Pylance v2023.8.20
2
Answers
The problem is addressed in this Pylance issue:
https://github.com/microsoft/pylance-release/issues/4685
The solution is to downgrade from Pyalnce v2023.8.xx to v2023.7.40, using the "Install" or "Uninstall" pulldown menu in the VS Code extension listing for Pylance.
I found the solution.
In my case, some file was corrupted. Find the location of the extension folder which is showing an error.
I noted that only uninstalling extension did not delete the folder, so I am guessing that when reinstall, it just loads from the same files again.