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

Add instructions for PyLance workaround. #935

Closed
wants to merge 4 commits into from

Conversation

SebastianGrans
Copy link

Microsoft prevents PyLance language server from running in unofficial builds, but an easy workaround is to modify product.json.
See #892.

I added instructions to the Docs.

DOCS.md Outdated Show resolved Hide resolved
@fmotaf fmotaf mentioned this pull request Dec 12, 2021
2 tasks
@GitMensch
Copy link
Collaborator

GitMensch commented Jan 27, 2022

As Jedi is always enabled if Pylance is not found wouldn't it be most reasonable to just uninstall/disable PyLance?

I don't have any setting for this done, so it is on Default and when checking the Output Pane, Python group the very first item says:

Starting Jedi language server.

DOCS.md Show resolved Hide resolved
Co-authored-by: Evan Boehs <[email protected]>
Copy link

@abstralexis abstralexis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly fine, however I recommend correcting the typos and making some of the language more formal.

**Option 2: Make PyLance think you are running the official builds**
If you want to use PyLance server, it is very easy to convince PyLance that it is running in an official build. As presented in [Issue 892](https://github.com/VSCodium/vscodium/issues/892#issuecomment-957850440), you simply need to modify a single entry in `product.json`.

`The file can be found here:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That extra ` may cause some issues:

Suggested change
`The file can be found here:
The file can be found here:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these paths are already in the document, better reference this instead of adding it again

* **MacOS**: `/Users/<user>/Library/Application Support/VSCodium/product.json`
* **Windows**: `%APPDATA%\VSCodium\product.json`

Modify the followning line:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"following" is misspelt:

Suggested change
Modify the followning line:
Modify the following line:

PyLance is Microsofts new [Python language server](https://devblogs.microsoft.com/python/announcing-pylance-fast-feature-rich-language-support-for-python-in-visual-studio-code/) which is one of the backend options for IntelliSense. This only works in the official VS Code builds. But there are two workarounds:

**Option 1: Use the Jedi language server**
Not much of a workaround, but one option is to not use PyLance and instead use the previous default: Jedi. This is done by adding the following line to `settings.json`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not much of a workaround, but

This could be more formal

@kolya-ay
Copy link

Shouldn't this info just be added to Extensions Compatibility Wiki?

@abstralexis
Copy link

I think adding a link to the workaround (or simple instructions to do so) in the "Replacements" section could be appropriate as Pylance is already stated there as only partially compatible.

@bxff
Copy link

bxff commented Dec 8, 2022

Also please refer: #940 (comment)

```
or through the UI under "Python: Language Server"

**Option 2: Make PyLance think you are running the official builds**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly insert Option 2: Use Pyright ?

@finnlogin
Copy link

Hello Sebastian!
I'm wondering if this method of using Pylance in VSCodium still works.
For Linux, you mentioned the directory: /home//.config/VSCodium/product.json
There was no such file there. So, I made a copy of product.json from usr/share/codium/resources/app/product.json and changed "nameLong".
Unfortunately, it didn't help and I'm still struggling with this problem.
Could you help me in this matter?

@Equim-chan
Copy link

It looks like this no longer works as of version 2023.8.20.

@daiyam
Copy link
Member

daiyam commented Aug 12, 2023

I'm closing this PR. Feel free to open a discussion if you want further talks.

The best solution is to have an open alternative for PyLance instead of trying the make a closed-source extension works...

@daiyam daiyam closed this Aug 12, 2023
@sergei-dyshel
Copy link

sergei-dyshel commented Aug 14, 2023

It looks like this no longer works as of version 2023.8.20.

Yeah, apparently starting from this version the product.json trick is not longer enough... 😭

@EndlessFractal
Copy link

If anyone still wants to bother with Pylance, the last working version can be found here.

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

No need for the product.json trick. Just install VSCodium, install the extension and you are ready to go.

Save it on your drive! Who knows for how long M$ will keep that link up.

The checksum for the file for posterity.

Name: ms-python.vscode-pylance-2023.6.40.vsix
Size: 13884740 bytes (13 MiB)
SHA256: 2799d1a108d454a68caacd10245634bf3bad8d667d747e8eec55c8f996486814
SHA1: 832b3ad87e042497a99156f7c7b07717f734c9f0
BLAKE2sp: 089240601221b6fecd13991490c925ac2f11b9ec51e96bd9b00dbbccfde151b7

@paulcarroty
Copy link
Collaborator

paulcarroty commented Aug 16, 2023

Let's just attach it:
ms-python.vscode-pylance-2023.6.40.vsix.zip

The hashes are above^.

@paulcarroty paulcarroty reopened this Aug 16, 2023
@GitMensch
Copy link
Collaborator

Would it be reasonable to distribute that as a built-in extension by including it in the patchset or do we know/guess that this is/will soon be broken?
The only possible downside I currently see are 12 MB...

@sergei-dyshel
Copy link

sergei-dyshel commented Aug 16, 2023

If anyone still wants to bother with Pylance

Strangely I couldn't find any reasonable data source on differences between Pylance and Pyright (we all know that Pylance is based on Pyright). Does anybody have a clue?

@sergei-dyshel
Copy link

Actually there is some information in Pylance FAQ:

What features are in Pylance but not in Pyright? What is the difference exactly?

Pylance has a handful of valuable features that are not available in Pyright, including semantic highlighting, refactoring code actions (extract variable/extract method), docstrings for built-in/standard library modules, and IntelliCode compatibility. Pylance also ships with a collection of type stubs for popular modules to provide fast and accurate auto-completions and type checking.

@daiyam
Copy link
Member

daiyam commented Aug 16, 2023

Would it be reasonable to distribute that as a built-in extension by including it in the patchset or do we know/guess that this is/will soon be broken?

No! VSCodium doesn't add features compared to Visual Studio Code. Also PyLance is closed-sourced and can be installed only with MS products (https://marketplace.visualstudio.com/items/ms-python.vscode-pylance/license)

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

Successfully merging this pull request may close these issues.