Skip to content

Commit e77f450

Browse files
authored
Update JediLSP to Jedi while diagnosing (#17549)
* Update JediLSP to Jedi while diagnosing * Fix test + add forgotten await
1 parent dba8563 commit e77f450

2 files changed

Lines changed: 204 additions & 157 deletions

File tree

src/client/application/diagnostics/checks/jediPython27NotSupported.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ export class JediPython27NotSupportedDiagnosticService extends BaseDiagnosticsSe
4848
const interpreter = await this.interpreterService.getActiveInterpreter(resource);
4949
const { languageServer } = this.configurationService.getSettings(resource);
5050

51+
await this.updateLanguageServerSetting(resource);
52+
5153
// We don't need to check for JediLSP here, because we retrieve the setting from the configuration service,
5254
// Which already switched the JediLSP option to Jedi.
5355
if (interpreter && (interpreter.version?.major ?? 0) < 3 && languageServer === LanguageServerType.Jedi) {
@@ -66,8 +68,6 @@ export class JediPython27NotSupportedDiagnosticService extends BaseDiagnosticsSe
6668
return;
6769
}
6870

69-
this.updateLanguageServerSetting(diagnostic.resource);
70-
7171
const commandFactory = this.serviceContainer.get<IDiagnosticsCommandFactory>(IDiagnosticsCommandFactory);
7272
const options = [
7373
{
@@ -82,7 +82,7 @@ export class JediPython27NotSupportedDiagnosticService extends BaseDiagnosticsSe
8282
await this.messageService.handle(diagnostic, { commandPrompts: options });
8383
}
8484

85-
private updateLanguageServerSetting(resource: Resource): void {
85+
private async updateLanguageServerSetting(resource: Resource): Promise<void | undefined> {
8686
// Update settings.json value to Jedi if it's JediLSP.
8787
const settings = this.workspaceService
8888
.getConfiguration('python', resource)
@@ -98,6 +98,11 @@ export class JediPython27NotSupportedDiagnosticService extends BaseDiagnosticsSe
9898
return;
9999
}
100100

101-
this.configurationService.updateSetting('languageServer', LanguageServerType.Jedi, resource, configTarget);
101+
await this.configurationService.updateSetting(
102+
'languageServer',
103+
LanguageServerType.Jedi,
104+
resource,
105+
configTarget,
106+
);
102107
}
103108
}

0 commit comments

Comments
 (0)