Skip to content

Disable language services if Pyrefly extension installed + active #24987

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

kinto0
Copy link

@kinto0 kinto0 commented Apr 16, 2025

For #24850

Summary:
Background:
A new typechecker called Pyrefly will be featured at Pycon with a talk, website/sandbox (still WIP), and extension (still WIP). This extension will provide ultrafast typechecking and language services. When the Pyrefly extension is installed, ms-python.python should not start Jedi or Pylance unless python.pyrefly.disableLanguageServices is set to true.

Because of the separation of vscode's getExtensions API and config reading logic, I chose to augment DefaultLSType with fallback information in case Pyrefly is disabled. This lets configSettings pick the correct jedi/pylance without knowing if Pyrefly will be enabled or disabled.

Test Plan:
still can't get pyright to work in the local extension build but I do see my breakpoints hit and the correct languageServer set

lowerquality.mp4

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@karthiknadig karthiknadig requested a review from rchiodo April 16, 2025 20:45
@karthiknadig karthiknadig self-assigned this Apr 16, 2025
@karthiknadig karthiknadig self-requested a review April 16, 2025 20:45
@kinto0
Copy link
Author

kinto0 commented Apr 16, 2025

Thanks for the quick review @rchiodo! I did not realize you would see draft PRs yet... I just updated the summary so it should make more sense.

@rchiodo
Copy link

rchiodo commented Apr 16, 2025

When you did this part:

Followed guide here. When running extension locally, I don't see any language services ever (before / after my changes). I'd appreciate help testing this integration since I'm not confident the configuration is set correctl

Did you clone into the extensions folder for vscode? I think that's what those directions are asking you to do? @karthiknadig would know more. Pylance would have to be installed in the extensions folder I think for your testing to work

@rchiodo
Copy link

rchiodo commented Apr 16, 2025

This error:

2025-04-16 15:22:19.725 [error] [
  'Starting language server, Class name = p, completed in 11208ms, has a falsy return value, , Return Value: undefined',
  [Error: command 'pyright.createtypestub' already exists
  	at cw.registerCommand (file:///private/var/folders/x0/z3j4vbzs3wqd0ynb6q24jglm0000gn/T/AppTranslocation/58C97911-06B4-4CA7-9068-D7D7F655735D/d/Visual%20Studio%20Code%202.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:115:31527)
  	at Object.registerCommand (file:///private/var/folders/x0/z3j4vbzs3wqd0ynb6q24jglm0000gn/T/AppTranslocation/58C97911-06B4-4CA7-9068-D7D7F655735D/d/Visual%20Studio%20Code%202.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:157:36729)
  	at t.ExecuteCommandFeature.register (/Users/kylei/.vscode/extensions/ms-python.python-2025.4.0-darwin-arm64/out/client/extension.js:2:2101514)
  	at t.ExecuteCommandFeature.initialize (/Users/kylei/.vscode/extensions/ms-python.python-2025.4.0-darwin-arm64/out/client/extension.js:2:2101091)
  	at P.initializeFeatures (/Users/kylei/.vscode/extensions/ms-python.python-2025.4.0-darwin-arm64/out/client/extension.js:2:2041419)
  	at P.doInitialize (/Users/kylei/.vscode/extensions/ms-python.python-2025.4.0-darwin-arm64/out/client/extension.js:2:2027694)
  	at async P.start (/Users/kylei/.vscode/extensions/ms-python.python-2025.4.0-darwin-arm64/out/client/extension.js:2:2024707)
  	at async Object.start (/Users/kylei/.vscode/extensions/ms-python.vscode-pylance-2025.4.1/dist/extension.bundle.js:1:148233)
  	at async _0x317b05._startClient (/Users/kylei/.vscode/extensions/ms-python.vscode-pylance-2025.4.1/dist/extension.bundle.js:1:84298)
  	at async _0x317b05._createNewRequest (/Users/kylei/.vscode/extensions/ms-python.vscode-pylance-2025.4.1/dist/extension.bundle.js:1:83758)
  	at async _0x317b05._enqueueRequestAndWaitForRun (/Users/kylei/.vscode/extensions/ms-python.vscode-pylance-2025.4.1/dist/extension.bundle.js:1:83000)
  	at async _0x317b05.startClient (/Users/kylei/.vscode/extensions/ms-python.vscode-pylance-2025.4.1/dist/extension.bundle.js:1:82482)
  	at async h.start (/Users/kylei/.vscode/extensions/ms-python.python-2025.4.0-darwin-arm64/out/client/extension.js:2:39831)]
]

Usually happens when pyright and pylance are enabled at the same time. It might also happen if pylance is started twice for some reason.

@karthiknadig karthiknadig added the feature-request Request for new features or functionality label Apr 16, 2025
@karthiknadig
Copy link
Member

@kinto0 Please look into and accept the CLA. Otherwise we can't merge this.

kinto0 added 2 commits April 18, 2025 13:03
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@kinto0
Copy link
Author

kinto0 commented Apr 18, 2025

@microsoft-github-policy-service agree [company="{your company}"]

@microsoft-github-policy-service agree [company="meta"]

@kinto0
Copy link
Author

kinto0 commented Apr 18, 2025

@microsoft-github-policy-service agree company="your company"

@microsoft-github-policy-service agree company="meta"

kinto0 and others added 3 commits April 18, 2025 17:57
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@kinto0 kinto0 marked this pull request as ready for review April 18, 2025 23:36
rchiodo
rchiodo previously approved these changes Apr 18, 2025
Copy link

@Crazy40528 Crazy40528 left a comment

Choose a reason for hiding this comment

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

kinto0:kinto/disable-with-pyrefly

kinto0 added 2 commits April 21, 2025 12:02
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@kinto0 kinto0 requested a review from karthiknadig April 21, 2025 19:02
kinto0 added 2 commits April 21, 2025 22:23
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@vs-code-engineering vs-code-engineering bot added this to the April 2025 milestone Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants