Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semantic highlighting for Python: Pylance issue 2023 #1556

Closed
finnlogin opened this issue Jun 29, 2023 · 28 comments
Closed

Semantic highlighting for Python: Pylance issue 2023 #1556

finnlogin opened this issue Jun 29, 2023 · 28 comments

Comments

@finnlogin
Copy link

Hi!
I have a problem with semantic highlighting in VSCodium (screenshot: VSCodium is on the left, VSCode is on the right). I have the same issue on MacOS and Linux Mint. After research, I found out that it has to do with the fact that Microsoft prevents PyLance language server from running in unofficial builds. In this thread there is a solution; however, it seems outdated because it doesn't work anymore.

Has anyone encountered this issue and managed to find a solution?

EArlF

@EndlessFractal
Copy link

Link to the last working version:

https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/vscode-pylance/2023.6.40/vspackage

Works perfectly as of writing. Just install it manually by going to extensions, click on the 3 dots and click on Install from VSIX, and select the downloaded file.

@finnlogin
Copy link
Author

It works for me too!
You're my savior! Thanks a bunch!

@ovo-Tim
Copy link

ovo-Tim commented Aug 11, 2023

Do we have any other options?We can't use old version for ever. 😢

@finnlogin
Copy link
Author

You can replace the version of the extension in the provided link with the latest one.
https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/vscode-pylance/2023.8.20/vspackage

@EndlessFractal
Copy link

EndlessFractal commented Aug 15, 2023

You can replace the version of the extension in the provided link with the latest one. https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/vscode-pylance/2023.8.20/vspackage

I've tested the 5 most recent versions (2023.8.21, 2023.8.20, 2023.8.11, 2023.8.10, 2023.7.43) and none work.

Until someone finds a workaround, the last known working version (2023.6.40) will have to do.

A screenshot of the latest VSCodium running the latest Pylance, notice that the color highlighting does not work.
image

Edit: @burritosoftware this might be of interest to you.

Cheers!

@finnlogin
Copy link
Author

You can replace the version of the extension in the provided link with the latest one. https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/vscode-pylance/2023.8.20/vspackage

I've tested the 5 most recent versions (2023.8.21, 2023.8.20, 2023.8.11, 2023.8.10, 2023.7.43) and none work.

Until someone finds a workaround, the last known working version (2023.6.40) will have to do.

A screenshot of the latest VSCodium running the latest Pylance, notice that the color highlighting does not work. image

Edit: @burritosoftware this might be of interest to you.

Cheers!

You're right! I downloaded and installed the latest version but never tested it. I'm sorry for misleading you guys.

@awsms
Copy link

awsms commented Aug 17, 2023

Thanks so much for the link @EndlessFractal, I tried everything, assuming it was an issue on my end. 🥲
Do you know if that's Microsoft enforcing the usage of their own extensions to proprietary VSCode-only, like they have done with the Copilot integration, the C# debugger etc?

@EndlessFractal
Copy link

Thanks so much for the link @EndlessFractal, I tried everything, assuming it was an issue on my end. 🥲 Do you know if that's Microsoft enforcing the usage of their own extensions to proprietary VSCode-only, like they have done with the Copilot integration, the C# debugger etc?

It is very possible, as they have taken measures in preventing its usage on the later versions, #935 shows this, as the previous trick of modifying the product.json no longer works.

@sergei-dyshel
Copy link

Hoping some another product.json trick is possible, I tried replacing entire file with the file from MS VScode and Pylance still didn't work 😭 Bye bye semantic highlighting and other goodies....

gothicVI added a commit to gothicVI/DotFiles that referenced this issue Aug 18, 2023
This was referenced Sep 5, 2023
@Rantunah
Copy link

Rantunah commented Sep 5, 2023

I went to check out the console for the Python Language Server with the Microsoft extensions and I got this:
Screenshot_20230905_182955

2023-09-05 18:24:57.301 [info] (Client) You may install and use any number of copies of the software only with Microsoft Visual Studio, Visual Studio for Mac, Visual Studio Code, Azure DevOps, Team Foundation Server, and successor Microsoft products and services (collectively, the “Visual Studio Products and Services”) to develop and test your applications. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. You may not: work around any technical limitations in the software that only allow you to use it in certain ways; reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the source code for the software, except and to the extent required by third party licensing terms governing use of certain open source components that may be included in the software; remove, minimize, block, or modify any notices of Microsoft or its suppliers in the software; use the software in any way that is against the law or to create or propagate malware; or share, publish, distribute, or lease the software (except for any distributable code, subject to the terms above), provide the software as a stand-alone offering for others to use, or transfer the software or this agreement to any third party.

So I guess that this might be Microsoft's attempt to enforce the license terms and force some users into VSCode.

@awsms
Copy link

awsms commented Sep 12, 2023

I tried all the builds (2023.6.x up to 2023.8.x), and 2023.8.10 is the last build that works for me. Wondering why it didn't work for you @EndlessFractal

@EndlessFractal
Copy link

I tried all the builds (2023.6.x up to 2023.8.x), and 2023.8.10 is the last build that works for me. Wondering why it didn't work for you @EndlessFractal

Have you tried it on a fresh installation?

As you can see below, I'm not able to get it fully working. I have not done any other changes beside installing Codium and the Python and the Pylance extensions.

Codium 1.82.0 with Pylance v2023.8.10

image

Codium 1.82.0 with Pylance v2023.6.40

image

Cheers!

@felix9743
Copy link

I wrote a solution to run Pylance in its latest version (I postponed as BUG without doing it on purpose): #1640

@pickx
Copy link

pickx commented Sep 25, 2023

I wrote a solution to run Pylance in its latest version (I postponed as BUG without doing it on purpose): #1640

@felix9743 This worked for me with v2023.9.20. Thank you.

@mrlee14
Copy link

mrlee14 commented Oct 11, 2023

I wrote a solution to run Pylance in its latest version (I postponed as BUG without doing it on purpose): #1640

works with v2023.8.20

@mrlee14
Copy link

mrlee14 commented Oct 11, 2023

I wrote a solution to run Pylance in its latest version (I postponed as BUG without doing it on purpose): #1640

works also with v2023.10.10

@alephpi
Copy link

alephpi commented Nov 3, 2023

image
Weirdly enough. Same issue, cannot fix, turns out to be I cannot even find pylance extension in codium

version: 1.83.1
Release: 23285
commit: 36d13de33ac0d6c684f10f99cff352e2f58228b3
date: 2023-10-12T18:26:29.496Z
Electron: 25.8.4
ElectronBuildId: undefined
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 6.1.0-1025-oem

back to use vscode for the moment 😢

@mrlee14
Copy link

mrlee14 commented Nov 13, 2023

I wrote a solution to run Pylance in its latest version (I postponed as BUG without doing it on purpose): #1640

works also with v2023.10.10

version 2023.11.10 ,still works!

method:
cd ~/.vscode-oss/extensions/ms-python.vscode-pylance-2023.11.10/dist
mv extension.bundle.js extension.bundle.js.bak

@leon-erd
Copy link

version 2023.11.10 ,still works!

It seems like it does for me as well.
But now my Jupyter Notebooks have problems to connect to the kernel (works if I disable and enable Jupyter extension but fails again on restart of VSCodium). So I will stay on 2023.6.40 for now... :/

@alecov
Copy link

alecov commented Nov 29, 2023

Link to the last working version:

https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/vscode-pylance/2023.6.40/vspackage

Works perfectly as of writing. Just install it manually by going to extensions, click on the 3 dots and click on Install from VSIX, and select the downloaded file.

I updated codium and suddenly the extension host stopped working. Extension bisect did not help, but I manually removed this version of pylance and it stopped crashing.

Then, attempting to reinstall pylance from the VSIX package yields "Corrupt ZIP: end of central directory record signature not found".

Has anyone faced this? Any workarounds?

@EndlessFractal
Copy link

Link to the last working version:

https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/vscode-pylance/2023.6.40/vspackage

Works perfectly as of writing. Just install it manually by going to extensions, click on the 3 dots and click on Install from VSIX, and select the downloaded file.

I updated codium and suddenly the extension host stopped working. Extension bisect did not help, but I manually removed this version of pylance and it stopped crashing.

Then, attempting to reinstall pylance from the VSIX package yields "Corrupt ZIP: end of central directory record signature not found".

Has anyone faced this? Any workarounds?

Sorry @alecov, I can't be of much help. I'm on the latest version and it hasn't crashed a single time. Have you tried reinstalling VSCodium? If it's still giving you issues, you can try this method and install a more recent version. #1641

image

Cheers!

@felix9743
Copy link

Lien vers la dernière version fonctionnelle :

https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/vscode-pylance/2023.6.40/vspackage

Fonctionne parfaitement au moment de l'écriture. Installez-le simplement manuellement en allant dans extensions, cliquez sur les 3 points et cliquez sur ** Installer depuis VSIX ** , et sélectionnez le fichier téléchargé.

J'ai mis à jour Codium et tout à coup, l'hôte de l'extension a cessé de fonctionner. L'extension bisect n'a pas aidé, mais j'ai supprimé manuellement cette version de pylance et elle a cessé de planter.

Ensuite, en essayant de réinstaller pylance à partir du package VSIX, vous obtenez "ZIP corrompu : signature d'enregistrement de fin de répertoire central introuvable".

Quelqu'un a-t-il été confronté à cela ? Des solutions de contournement ?

Hi, if that helps you a little, try to remove Pylance, Python and Jupyter from your extension list. Restart and close VSCodium and Then check that you no longer have the folders of its extension in your folder .vscode-oss/extensions and, after restarting VSCodium, check that it is properly updated.

Once all this is done, either you have define the custom value of the extensionsGallery in product.json and so, you can reinstall the 3 extensions, either you have to download their latest version (but I have not tested like this) and install them. Then you close VSCodium and you make the changes from step 4 (I just explained step 3).

After that, normally Pylance and Jupyter (if you use) should work properly.

PS: There was a version or 2 or this trick didn't work anymore but strangely, it's reworking now....


For information, it works for me with the latest versions:

  • Windows 10 and VSCodium v1.84.2
  • Python v2023.20.0 and Pylance v2023.11.10
  • Jupyter v2023.10.11

@fithisux
Copy link

fithisux commented Dec 8, 2023

Do we need PyLance to work with Python? I do not want Pylance. Are there any other options?

@EndlessFractal
Copy link

Do we need PyLance to work with Python? I do not want Pylance. Are there any other options?

You do not. Pylance is just to make the Python code more legible by adding colors, also known as, semantic highlighting.

@fithisux
Copy link

fithisux commented Dec 9, 2023

By the way @EndlessFractal there is a set of utils by ms-python for mypy/isort/black/pylint that work very good.

For some cases (maybe I misconfigured) mypy has accurate semantic highlighting if you specify types. I changed a type to str and worked immediately. What mypy finds, it is reported.

Works fine with latest mypy and vscodium pointing to the worksapce mypy.

What does not work is the "quick fix"

@alecov
Copy link

alecov commented Dec 12, 2023

@EndlessFractal @felix9743 Thanks mates, the tip from @felix9743 actually worked, although I'm pretty sure I have tried it before posting here.

@pickx
Copy link

pickx commented Dec 14, 2023

after several tries, confirming that this method does not work with 2023.12.1 on my machine.
it works with 2023.11.10.

@Splarkszter
Copy link

Confirmed working with 2023.6.40

Had a bit of a struggle but after disabling and enabling the main Python extension the semantic highlighting is working now!
image

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests