microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.72k stars 766 forks source link

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

Open jontwo opened 1 year ago

jontwo commented 1 year ago

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

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

AlexanderPershin commented 1 year ago

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

Zeroc0077 commented 1 year ago

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

txz32102 commented 1 year ago

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

txz32102 commented 1 year ago

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

Prunoideae commented 1 year ago

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

dtlnor commented 1 year ago

Same here, rolling back to v2023.10.40 solved.

SavvasMohito commented 1 year ago

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

debonte commented 1 year ago

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

burnhardo commented 1 year ago

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.

nathanm commented 1 year ago

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.

flyforwardFast commented 1 year ago

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

debonte commented 1 year ago

@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.

flyforwardFast commented 1 year ago

@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.

netexpoarthur commented 1 year ago

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.

WASasquatch commented 1 year ago

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?

SavvasMohito commented 1 year ago

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.

WASasquatch commented 1 year ago

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.

vincent-teh commented 1 year ago

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.

git-afsantos commented 1 year ago

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.

debonte commented 1 year ago

@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.

dspyz-matician commented 1 year ago

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.

rd-andreas-lay commented 1 year ago

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
KacieKK commented 11 months ago

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

jontwo commented 9 months ago

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?

rchiodo commented 8 months ago

@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

jontwo commented 8 months ago

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.

rchiodo commented 8 months ago

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 commented 8 months ago

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.