Skip to content

Commit

Permalink
Changed check in the pyright VS Code extension for the presence of Py…
Browse files Browse the repository at this point in the history
…lance. If Pylance is installed in the workspace but is not configured to be loaded (i.e. the "python.languageServer" is set to "None"), then pyright will allow itself to be loaded. This addresses #9325.
  • Loading branch information
erictraut committed Oct 29, 2024
1 parent 55adfbd commit c723170
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/vscode-pyright/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ const pythonPathChangedListenerMap = new Map<string, string>();
const defaultHeapSize = 3072;

export async function activate(context: ExtensionContext) {
const pythonSettings = workspace.getConfiguration('python');
const langServer = pythonSettings.get('languageServer');

// See if Pylance is installed. If so, don't activate the Pyright extension.
// Doing so will generate "command already registered" errors and redundant
// hover text, etc.because the two extensions overlap in functionality.
const pylanceExtension = extensions.getExtension('ms-python.vscode-pylance');
if (pylanceExtension) {
if (pylanceExtension && langServer !== 'None') {
window.showErrorMessage(
'Pyright has detected that the Pylance extension is installed. ' +
'Pylance includes the functionality of Pyright, and running both of ' +
Expand Down

0 comments on commit c723170

Please sign in to comment.