pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

Syntax highlighting and code completion stops working in v2023.9.10 onwards

Open jontwo opened this issue 2 years ago • 28 comments

I'm aware that this looks like a duplicate issue - there are many other tickets on the same topic. The language server just stops working (or is maybe very, very slow) with no obvious signs in the log.

I have found that the problem does go away when you install v2023.8.50, anything newer than that and the problem comes back.

Environment data

  • Language Server version: v2023.9.10 and newer versions (problem is not seen in v2023.8.50 and older)
  • OS and version: VSCode - Windows 10 Pro, Pylance and developer environment - Ubuntu 22.04
  • Python version (& distribution if applicable, e.g. Anaconda): 3.10, Ubuntu default system install

Code Snippet

Code snippet is not appropriate here, as the issue is likely to do with my setup. I'm developing on a remote machine over ssh and there are multiple folders in the workspace. Only one has the Pylance issue, the others work ok.

Repro Steps

As above, you'd have to start an ssh session then add multiple repositories to the workspace.

Logs

See attached log - farmlib is the repository that stops working. The others work fine. pylance_log_20231027.txt

jontwo avatar Oct 27 '23 07:10 jontwo

I've encountered the same issue. Fixed it by downgrading to previous version

AlexanderPershin avatar Oct 27 '23 08:10 AlexanderPershin

The same issue😂😂, but it works well on my windows laptop with python3.11🤔

Zeroc0077 avatar Oct 27 '23 09:10 Zeroc0077

same issue, even after i clean all the data and do a fresh installation(ubuntu22.04) image image

txz32102 avatar Oct 27 '23 10:10 txz32102

same issue, even after i clean all the data and do a fresh installation(ubuntu22.04) image image

Version: 1.83.1 Commit: f1b07bd25dfad64b0167beb15359ae573aecd2cc Date: 2023-10-10T23:45:31.402Z Electron: 25.8.4 ElectronBuildId: 24154031 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Linux x64 6.2.0-35-generic

txz32102 avatar Oct 27 '23 11:10 txz32102

Same issue, but rolling back to v2023.10.40 is fine for me.

Prunoideae avatar Oct 27 '23 12:10 Prunoideae

Same here, rolling back to v2023.10.40 solved.

dtlnor avatar Oct 27 '23 13:10 dtlnor

Same issue with python v3.10.12. Previous pylance version works properly

SavvasMohito avatar Oct 27 '23 14:10 SavvasMohito

Duplicate of https://github.com/microsoft/pylance-release/issues/4846?

debonte avatar Oct 27 '23 14:10 debonte

Same problem, but i am using Python embeddable Package 3.12. No Intellisense and Highlighting anymore, downgrade to 2023.10.40 and all is working.

burnhardo avatar Oct 27 '23 17:10 burnhardo

Same issue, but rolling back to 2023.10.40 doesn't fix it. In fact, rolling back to versions that used to work don't fix it either, using both official and pre-release versions. This also might be related to issue 4862, which was when I noticed the code highlighting had stopped working. That got fixed in a pre-release version (2023.9.31), but that fix must not have been merged in the latest releases.

nathanm avatar Oct 27 '23 18:10 nathanm

I just upgraded to Pre-Release version v2023.10.53. It seems to work fine.

flyforwardFast avatar Oct 27 '23 22:10 flyforwardFast

@flyforward2016, if you believed you were seeing this issue in 2023.10.52 and it went away in 2023.10.53, what you were actually hitting was #5009.

Although the code at the core of the #5009 crash is quite old, the code that was causing everyone to hit it was only added a couple weeks ago. Since @jontwo said that they needed to go all the way back to a Pylance build from the end of August to work around this issue, I believe they are unrelated.

debonte avatar Oct 27 '23 22:10 debonte

@debonte, You are right and I misunderstood the thread above. My issue was that both syntax highlight during "import session" and "go to definition" stopped working. I do see "The Pylance server crashed 5 times in the last 3 minutes" popping up. After upgrading to 2023.10.53 pre-release fixed the issue.

flyforwardFast avatar Oct 27 '23 23:10 flyforwardFast

Same issue here.

Version: 1.83.1 (user setup) Date: 2023-10-10T23:48:05.904Z Electron: 25.8.4 ElectronBuildId: 24154031 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Windows_NT x64 10.0.22621

upgraded to Pre-Release fix that to.

netexpoarthur avatar Oct 28 '23 07:10 netexpoarthur

May be a good idea to go over the steps to "rollback", whatever that means in the context of a packaged binary installation on windows, etc.

I'm experiencing the same issue, but it occurred on it's own, without any manual installation or upgrading. Just like yesterday or the day before it just stopped working. I've uninstalled and reinstalled pylance and python extension for vscode. How do I "rollback" or target specific versions of extensions?

WASasquatch avatar Oct 29 '23 20:10 WASasquatch

May be a good idea to go over the steps to "rollback", whatever that means in the context of a packaged binary installation on windows, etc.

I'm experiencing the same issue, but it occurred on it's own, without any manual installation or upgrading. Just like yesterday or the day before it just stopped working. I've uninstalled and reinstalled pylance and python extension for vscode. How do I "rollback" or target specific versions of extensions?

In vscode, go to the extensions tab and right click on the pylance extension. Then you should have an option to "install another version" and select a previous version.

SavvasMohito avatar Oct 29 '23 20:10 SavvasMohito

May be a good idea to go over the steps to "rollback", whatever that means in the context of a packaged binary installation on windows, etc. I'm experiencing the same issue, but it occurred on it's own, without any manual installation or upgrading. Just like yesterday or the day before it just stopped working. I've uninstalled and reinstalled pylance and python extension for vscode. How do I "rollback" or target specific versions of extensions?

In vscode, go to the extensions tab and right click on the pylance extension. Then you should have an option to "install another version" and select a previous version.

My buddy said similar, but I couldn't find a install another version in the context menu. Just disable extension, etc. However, I did find that switching to the pre-release that is being served right now, resolved the issue.

WASasquatch avatar Oct 29 '23 20:10 WASasquatch

May be a good idea to go over the steps to "rollback", whatever that means in the context of a packaged binary installation on windows, etc. I'm experiencing the same issue, but it occurred on it's own, without any manual installation or upgrading. Just like yesterday or the day before it just stopped working. I've uninstalled and reinstalled pylance and python extension for vscode. How do I "rollback" or target specific versions of extensions?

In vscode, go to the extensions tab and right click on the pylance extension. Then you should have an option to "install another version" and select a previous version.

My buddy said similar, but I couldn't find a install another version in the context menu. Just disable extension, etc. However, I did find that switching to the pre-release that is being served right now, resolved the issue.

Currently, I'm using v2023.10.53 of Pylance with v2023.18.0 VSCode Python extension and resolved the infinite syntax loading issue. There seems to be an issue with the current release version of Pylance 2023.10.50. I also tried to update the VScode Python extension to v2023.19.13001012 but it threw a language server crashing error immediately after updating.

vincent-teh avatar Oct 30 '23 04:10 vincent-teh

I am also experiencing Pylance server crashes with version v2023.10.40 onwards on a Windows 11 laptop. Rolling back to v2023.10.30 seems to fix it. Python extension is at v2023.9.11461009.

This is the only line of output that seems to be relevant.

2023-10-30 13:28:10.056 [info] AssignProcessToJobObject: (87) The parameter is incorrect.

git-afsantos avatar Oct 30 '23 13:10 git-afsantos

@git-afsantos, I think you're hitting a different issue. The original poster's log above does not contain an error about AssignProcessToJobObject.

Please see https://github.com/microsoft/pylance-release/issues/5055 instead.

debonte avatar Oct 30 '23 19:10 debonte

I'm finding that standalone Python files (with no other dependencies within the workspace) are very slow to typecheck, but if I move them to a small workspace, they typecheck right away.

dspyz-matician avatar Nov 03 '23 15:11 dspyz-matician

I have the same problem however highlighting only stops in notebooks (ipynb), not in Python modules.

Running Pylance v2023.11.10 and Python ext. v2023.20.0 pylance also keeps detecting problems in deleted files (The editor could not be opened because the file was not found.):

image

The interim files may come from one of my pre-commits:

-   repo: local
    hooks:
    -   id: mypy-jupyter
        name: mypy-jupyter
        entry: nbqa mypy
        language: system
        types: [jupyter]
        require_serial: true
    -   id: black
        name: black
        entry: black
        language: system
        types_or: [python, jupyter]
        require_serial: true
    -   id: flake8-jupyter
        name: flake8-jupyter
        entry: nbqa flake8
        args:
          - "--ignore=E402"
        language: system
        types: [jupyter]
        require_serial: true
    -   id: isort-jupyter
        name: isort-jupyter
        entry: nbqa isort
        language: system
        types: [jupyter]
        require_serial: true
    -   id: nb-clean
        name: nb-clean
        entry: nb-clean clean
        language: system
        types: [jupyter]
        require_serial: true

rd-andreas-lay avatar Nov 09 '23 14:11 rd-andreas-lay

Hey @rd-andreas-lay, I think you're hitting a different issue, do you mind open a separate ticket for that?

KacieKK avatar Dec 12 '23 00:12 KacieKK

Many releases later and this is still a problem for me. I have tried the latest versions, but syntax highlighting does not work for me unless I roll back to v2023.8.50. Is there any way I can provide more information to you about the problem?

jontwo avatar Feb 16 '24 08:02 jontwo

@jontwo we'd need a repro and the logs as described here: https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#filing-an-issue

rchiodo avatar Feb 16 '24 17:02 rchiodo

I'll see what I can do, but providing a repro is a bit tricky. The failure is intermittent and seems to mostly affect one private repo that I work on. I have provided logs above though.

jontwo avatar Feb 16 '24 17:02 jontwo

It sure looks like it's working. At least from the log. These entries show us handling the getSemanticTokens, which is the LSP request that provides the colorization data:

2023-10-27 07:58:46.117 [info] (38682) [BG(2)] getSemanticTokens range 22:0 - 128:62 at /home/jontwo/repositories/farmlib/farmlib/vectors/tests/test_feature_functions.py (6ms)
2023-10-27 07:58:46.216 [info] (38682) [BG(2)] analyzing: /home/jontwo/repositories/farmlib/farmlib/vectors/tests/test_feature_functions.py ...
2023-10-27 07:58:46.216 [info] (38682) [BG(2)]   checking: /home/jontwo/repositories/farmlib/farmlib/vectors/tests/test_feature_functions.py (99ms)
2023-10-27 07:58:46.216 [info] (38682) [BG(2)] analyzing: /home/jontwo/repositories/farmlib/farmlib/vectors/tests/test_feature_functions.py (99ms)
2023-10-27 07:58:46.224 [info] (38682) [BG(2)] getSemanticTokens range 22:0 - 128:62 at /home/jontwo/repositories/farmlib/farmlib/vectors/tests/test_feature_functions.py (7ms)
2023-10-27 07:58:46.236 [info] (38682) [BG(2)] indexing: /home/jontwo/repositories/farmlib/farmlib/vectors/tests/test_feature_functions.py [found 12] (6ms)

There's another option for tracing that will trace the actual LSP messages.

If you set this, all LSP messages should be logged in the output window:

"python.trace.server": "verbose"

We'd then have to look at the textDocument/semanticTokenRange and textDocument/semanticTokenFull messages and see if they're returning anything.

rchiodo avatar Feb 16 '24 17:02 rchiodo

Generally with the full LSP logging on, there's a ton of messages. To reproduce, you'd load a file that has a highlighting issue, clear the contents of the output window and then scroll the window.

Scrolling the window should cause VS code to ask us for new token information and have a textDocument/semanticTokenRange show up.

rchiodo avatar Feb 16 '24 17:02 rchiodo